[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160225075038.GC7333@mwanda>
Date: Thu, 25 Feb 2016 10:50:38 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Liam Girdwood <lgirdwood@...il.com>
Cc: Mark Brown <broonie@...nel.org>, Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
anish kumar <yesanishhere@...il.com>,
Axel Lin <axel.lin@...ics.com>, alsa-devel@...a-project.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [patch 2/2] 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 <dan.carpenter@...cle.com>
diff --git a/sound/soc/codecs/max9867.c b/sound/soc/codecs/max9867.c
index 4fb6fc7..9fb03c6 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:
Powered by blists - more mailing lists