kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next][V2] ASoC: rsnd: check for zero node count
@ 2021-06-03 11:03 Colin King
  2021-06-03 18:42 ` Mark Brown
  2021-06-08 10:43 ` Geert Uytterhoeven
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2021-06-03 11:03 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Kuninori Morimoto, alsa-devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

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")
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
V2: Rephrase commit message based on Dan Carpenter's suggestion.
    Thanks Dan!
---

 sound/soc/sh/rcar/ssiu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/soc/sh/rcar/ssiu.c b/sound/soc/sh/rcar/ssiu.c
index 5682c74bb7ff..0d8f97633dd2 100644
--- a/sound/soc/sh/rcar/ssiu.c
+++ b/sound/soc/sh/rcar/ssiu.c
@@ -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;
-- 
2.31.1


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

* Re: [PATCH][next][V2] ASoC: rsnd: check for zero node count
  2021-06-03 11:03 [PATCH][next][V2] ASoC: rsnd: check for zero node count Colin King
@ 2021-06-03 18:42 ` Mark Brown
  2021-06-08 10:43 ` Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2021-06-03 18:42 UTC (permalink / raw)
  To: Colin King, Jaroslav Kysela, Liam Girdwood, alsa-devel,
	Takashi Iwai, Kuninori Morimoto
  Cc: Mark Brown, linux-kernel, kernel-janitors

On Thu, 3 Jun 2021 12:03:15 +0100, Colin King wrote:
> 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

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

* Re: [PATCH][next][V2] ASoC: rsnd: check for zero node count
  2021-06-03 11:03 [PATCH][next][V2] ASoC: rsnd: check for zero node count Colin King
  2021-06-03 18:42 ` Mark Brown
@ 2021-06-08 10:43 ` Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2021-06-08 10:43 UTC (permalink / raw)
  To: Colin King
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Kuninori Morimoto, ALSA Development Mailing List,
	kernel-janitors, Linux Kernel Mailing List

Hi Colin,

Thanks for your patch!

On Thu, Jun 3, 2021 at 1:05 PM Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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.

> 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")
> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> V2: Rephrase commit message based on Dan Carpenter's suggestion.
>     Thanks Dan!


Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

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

end of thread, other threads:[~2021-06-08 10:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 11:03 [PATCH][next][V2] ASoC: rsnd: check for zero node count Colin King
2021-06-03 18:42 ` Mark Brown
2021-06-08 10:43 ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).