From: Dan Carpenter <dan.carpenter@oracle.com>
To: Liam Girdwood <lgirdwood@gmail.com>
Cc: alsa-devel@alsa-project.org, Axel Lin <axel.lin@ingics.com>,
anish kumar <yesanishhere@gmail.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
Takashi Iwai <tiwai@suse.com>, Mark Brown <broonie@kernel.org>
Subject: [patch 2/2] ASoC: max9867: silence and array overflow warning
Date: Thu, 25 Feb 2016 10:50:38 +0300 [thread overview]
Message-ID: <20160225075038.GC7333@mwanda> (raw)
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:
next reply other threads:[~2016-02-25 7:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-25 7:50 Dan Carpenter [this message]
2016-02-25 8:18 ` [patch 2/2] ASoC: max9867: silence and array overflow warning Axel Lin
2016-02-26 2:47 ` Applied "ASoC: max9867: silence and array overflow warning" to the asoc tree Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160225075038.GC7333@mwanda \
--to=dan.carpenter@oracle.com \
--cc=alsa-devel@alsa-project.org \
--cc=axel.lin@ingics.com \
--cc=broonie@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tiwai@suse.com \
--cc=yesanishhere@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox