The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [patch 2/2] ASoC: max9867: silence and array overflow warning
@ 2016-02-25  7:50 Dan Carpenter
  2016-02-25  8:18 ` Axel Lin
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-02-25  7:50 UTC (permalink / raw)
  To: Liam Girdwood
  Cc: Mark Brown, Jaroslav Kysela, Takashi Iwai, anish kumar, Axel Lin,
	alsa-devel, linux-kernel, kernel-janitors

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@oracle.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:

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch 2/2] ASoC: max9867: silence and array overflow warning
  2016-02-25  7:50 [patch 2/2] ASoC: max9867: silence and array overflow warning Dan Carpenter
@ 2016-02-25  8:18 ` Axel Lin
  0 siblings, 0 replies; 2+ messages in thread
From: Axel Lin @ 2016-02-25  8:18 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	anish kumar, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org, kernel-janitors

2016-02-25 15:50 GMT+08:00 Dan Carpenter <dan.carpenter@oracle.com>:
> 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@oracle.com>
Reviewed-by: Axel Lin <axel.lin@ingics.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-25  8:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-25  7:50 [patch 2/2] ASoC: max9867: silence and array overflow warning Dan Carpenter
2016-02-25  8:18 ` Axel Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox