ASoC: ak4613: Fix out of bounds array access for ak4613_iface
authorAxel Lin <axel.lin@ingics.com>
Fri, 9 Jun 2017 07:01:21 +0000 (15:01 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 9 Jun 2017 17:39:25 +0000 (18:39 +0100)
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/ak4613.c

index b2dfddead22774cc85a9b4612b8edbfd3ceffa5c..987918628d5b58f721771706f78655529ade1f71 100644 (file)
@@ -345,7 +345,7 @@ static int ak4613_dai_hw_params(struct snd_pcm_substream *substream,
                if (ak4613_dai_fmt_matching(priv->iface, is_play, fmt, width))
                        iface = priv->iface;
        } else {
-               for (i = ARRAY_SIZE(ak4613_iface); i >= 0; i--) {
+               for (i = ARRAY_SIZE(ak4613_iface) - 1; i >= 0; i--) {
                        if (!ak4613_dai_fmt_matching(ak4613_iface + i,
                                                     is_play,
                                                     fmt, width))