Skip to contentSkip to conversation

ASoC: rsnd: check for zero node count

PATCH In review Colin King 3 participants 3 messages Jun 3, 2021 – Jun 8, 2021

Subsystems (4)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH v2 1/1 ASoC: rsnd: check for zero node count

From: Colin Ian King <[email protected]>

Most callers of_get_child_count() check that "nr" is non-zero so it causes a static checker warning when we don't do that here. This does not cause a problem or a crash, but having zero SSUIes does not make sense either so let's add a check.

Addresses-Coverity: ("Unchecked return value")

Fixes c413983eb66a ("ASoC: rsnd: adjust disabled module")

---
V2: Rephrase commit message based on Dan Carpenter's suggestion.
Thanks Dan!
---

 sound/soc/sh/rcar/ssiu.c | 3 +++
 1 file changed, 3 insertions(+)
sound/soc/sh/rcar/ssiu.c +3 -0
index 5682c74bb7ff..0d8f97633dd2 100644
@@ -515,6 +515,9 @@ int rsnd_ssiu_probe(struct rsnd_priv *priv)
 	else
 		nr = priv->ssi_nr;
 
+	if (!nr)
+		return -EINVAL;
+
 	ssiu	= devm_kcalloc(dev, nr, sizeof(*ssiu), GFP_KERNEL);
 	if (!ssiu)
 		return -ENOMEM;
Signature · 1 line
2.31.1
maintainer
#1 lore raw
Quoted 4 lines · Colin King

Most callers of_get_child_count() check that "nr" is non-zero so it causes a static checker warning when we don't do that here. This does not cause a problem or a crash, but having zero SSUIes does not make sense either so let's add a check.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: rsnd: check for zero node count

      commit: d66e033910593d99700cd9e2a75698395fcd676f

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

#2 lore raw
In reply to Colin King

Hi Colin,

Thanks for your patch!

Quoted 3 lines · Colin King

From: Colin Ian King <[email protected]>

Most callers of_get_child_count() check that "nr" is non-zero so it

Note that there is no longer a call to of_get_child_count(), as of the commit referred to from the Fixes tag below.

Quoted 11 lines

causes a static checker warning when we don't do that here. This does not cause a problem or a crash, but having zero SSUIes does not make sense either so let's add a check.

Addresses-Coverity: ("Unchecked return value")

Fixes c413983eb66a ("ASoC: rsnd: adjust disabled module")

---
V2: Rephrase commit message based on Dan Carpenter's suggestion.
Thanks Dan!

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds