From: Dan Carpenter Date: Thu, 25 Feb 2016 07:50:38 +0000 (+0300) Subject: ASoC: max9867: silence and array overflow warning X-Git-Tag: next-20160301~62^2~4^2 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=90966391005e69a8964350278917a87fe49adf0f;p=karo-tx-linux.git ASoC: max9867: silence and array overflow warning Smatch complains that we might reach the end of this loop without finding what we're looking for leading to a buffer overflow. Signed-off-by: Dan Carpenter Reviewed-by: Axel Lin Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/max9867.c b/sound/soc/codecs/max9867.c index f371a52fe29d..2a22fddeb6af 100755 --- a/sound/soc/codecs/max9867.c +++ b/sound/soc/codecs/max9867.c @@ -156,6 +156,8 @@ static inline int get_ni_value(int mclk, int rate) if (ni_div[i].mclk >= mclk) break; } + if (i == ARRAY_SIZE(ni_div)) + return -EINVAL; switch (rate) { case 8000: