All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 2/2] ASoC: max9867: silence and array overflow warning
@ 2016-02-25  7:50 ` Dan Carpenter
  0 siblings, 0 replies; 6+ 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] 6+ messages in thread

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

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] 6+ messages in thread

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

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] 6+ messages in thread

* Re: [patch 2/2] ASoC: max9867: silence and array overflow warning
  2016-02-25  7:50 ` Dan Carpenter
@ 2016-02-25  8:18   ` Axel Lin
  -1 siblings, 0 replies; 6+ 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, linux-kernel, 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] 6+ messages in thread

* Re: [patch 2/2] ASoC: max9867: silence and array overflow warning
@ 2016-02-25  8:18   ` Axel Lin
  0 siblings, 0 replies; 6+ 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, linux-kernel, 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] 6+ messages in thread

* Applied "ASoC: max9867: silence and array overflow warning" to the asoc tree
  2016-02-25  7:50 ` Dan Carpenter
                   ` (2 preceding siblings ...)
  (?)
@ 2016-02-26  2:47 ` Mark Brown
  -1 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2016-02-26  2:47 UTC (permalink / raw)
  To: Dan Carpenter, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: max9867: silence and array overflow warning

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 90966391005e69a8964350278917a87fe49adf0f Mon Sep 17 00:00:00 2001
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Thu, 25 Feb 2016 10:50:38 +0300
Subject: [PATCH] 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@oracle.com>
Reviewed-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/max9867.c | 2 ++
 1 file changed, 2 insertions(+)

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:
-- 
2.7.0

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

end of thread, other threads:[~2016-02-26  2:47 UTC | newest]

Thread overview: 6+ 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  7:50 ` Dan Carpenter
2016-02-25  7:50 ` Dan Carpenter
2016-02-25  8:18 ` Axel Lin
2016-02-25  8:18   ` Axel Lin
2016-02-26  2:47 ` Applied "ASoC: max9867: silence and array overflow warning" to the asoc tree Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.