3.18-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jyri Sarha <jsa...@ti.com>

commit bbc686b34650b0f54affe9d9a637ccbe02b03760 upstream.

Fix off by one read beyond the end of a table.

Reported-by: David Binderman <dcb...@hotmail.com>
Signed-off-by: Jyri Sarha <jsa...@ti.com>
Signed-off-by: Mark Brown <broo...@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>

---
 sound/soc/codecs/tlv320aic31xx.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -911,12 +911,13 @@ static int aic31xx_set_dai_sysclk(struct
        }
        aic31xx->p_div = i;
 
-       for (i = 0; aic31xx_divs[i].mclk_p != freq/aic31xx->p_div; i++) {
-               if (i == ARRAY_SIZE(aic31xx_divs)) {
-                       dev_err(aic31xx->dev, "%s: Unsupported frequency %d\n",
-                               __func__, freq);
-                       return -EINVAL;
-               }
+       for (i = 0; i < ARRAY_SIZE(aic31xx_divs) &&
+                    aic31xx_divs[i].mclk_p != freq/aic31xx->p_div; i++)
+               ;
+       if (i == ARRAY_SIZE(aic31xx_divs)) {
+               dev_err(aic31xx->dev, "%s: Unsupported frequency %d\n",
+                       __func__, freq);
+               return -EINVAL;
        }
 
        /* set clock on MCLK, BCLK, or GPIO1 as PLL input */


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to