summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2018-09-06 03:21:33 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-10-18 09:16:21 +0200
commitad9ad950a37bd6038ff61244d1a3c7c471399335 (patch)
tree85df40990e0fef303978f739e6889232459188f6
parent6d52f3e1e729116b686d61481f85ff9c204c77a3 (diff)
downloadlinux-stable-ad9ad950a37bd6038ff61244d1a3c7c471399335.tar.gz
linux-stable-ad9ad950a37bd6038ff61244d1a3c7c471399335.tar.bz2
linux-stable-ad9ad950a37bd6038ff61244d1a3c7c471399335.zip
ASoC: rsnd: adg: care clock-frequency size
[ Upstream commit 69235ccf491d2e26aefd465c0d3ccd1e3b2a9a9c ] ADG has buffer over flow bug if DT has more than 3 clock-frequency. This patch fixup this issue, and uses first 2 values. clock-frequency = <x y>; /* this is OK */ clock-frequency = <x y z>; /* this is NG */ Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--sound/soc/sh/rcar/adg.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c
index e28edb1f7263..eb7879bcc6a7 100644
--- a/sound/soc/sh/rcar/adg.c
+++ b/sound/soc/sh/rcar/adg.c
@@ -467,6 +467,11 @@ static void rsnd_adg_get_clkout(struct rsnd_priv *priv,
goto rsnd_adg_get_clkout_end;
req_size = prop->length / sizeof(u32);
+ if (req_size > REQ_SIZE) {
+ dev_err(dev,
+ "too many clock-frequency, use top %d\n", REQ_SIZE);
+ req_size = REQ_SIZE;
+ }
of_property_read_u32_array(np, "clock-frequency", req_rate, req_size);
req_48kHz_rate = 0;