Skip to contentSkip to conversation

ASoC: max9867: silence and array overflow warning

PATCH In review Dan Carpenter 3 participants 3 messages Feb 25, 2016 – Feb 26, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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.

sound/soc/codecs/max9867.c +2 -0
index 4fb6fc7..9fb03c6 100755
@@ -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:
maintainer
#2 lore raw

Applied "ASoC: max9867: silence and array overflow warning" to the asoc tree

In reply to Dan Carpenter

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

Quoted 1 line

From 90966391005e69a8964350278917a87fe49adf0f Mon Sep 17 00:00:00 2001

From: Dan Carpenter <[email protected]>
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.

---
 sound/soc/codecs/max9867.c | 2 ++
 1 file changed, 2 insertions(+)
sound/soc/codecs/max9867.c +2 -0
index f371a52fe29d..2a22fddeb6af 100755
@@ -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:
Signature · 1 line
2.7.0