All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jian Cai <caij2003@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: caij2003@gmail.com, Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ASoC: soc-core: fix an uninitialized use
Date: Thu,  6 Feb 2020 12:03:45 -0800	[thread overview]
Message-ID: <20200206200345.175344-1-caij2003@gmail.com> (raw)

Fixed the uninitialized use of a signed integer variable ret in
soc_probe_component when all its definitions are not executed. This
caused  -ftrivial-auto-var-init=pattern to initialize the variable to
repeated 0xAA (i.e. a negative value) and triggered the following code
unintentionally.

err_probe:
	if (ret < 0)
		soc_cleanup_component(component);

Signed-off-by: Jian Cai <caij2003@gmail.com>
---
 sound/soc/soc-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 068d809c349a..bfb813ba34f3 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1180,7 +1180,7 @@ static int soc_probe_component(struct snd_soc_card *card,
 		snd_soc_component_get_dapm(component);
 	struct snd_soc_dai *dai;
 	int probed = 0;
-	int ret;
+	int ret = 0;
 
 	if (!strcmp(component->name, "snd-soc-dummy"))
 		return 0;
-- 
2.25.0.341.g760bfbb309-goog


WARNING: multiple messages have this Message-ID (diff)
From: Jian Cai <caij2003@gmail.com>
Cc: alsa-devel@alsa-project.org, Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org, Takashi Iwai <tiwai@suse.com>,
	Mark Brown <broonie@kernel.org>,
	caij2003@gmail.com
Subject: [alsa-devel] [PATCH] ASoC: soc-core: fix an uninitialized use
Date: Thu,  6 Feb 2020 12:03:45 -0800	[thread overview]
Message-ID: <20200206200345.175344-1-caij2003@gmail.com> (raw)

Fixed the uninitialized use of a signed integer variable ret in
soc_probe_component when all its definitions are not executed. This
caused  -ftrivial-auto-var-init=pattern to initialize the variable to
repeated 0xAA (i.e. a negative value) and triggered the following code
unintentionally.

err_probe:
	if (ret < 0)
		soc_cleanup_component(component);

Signed-off-by: Jian Cai <caij2003@gmail.com>
---
 sound/soc/soc-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 068d809c349a..bfb813ba34f3 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1180,7 +1180,7 @@ static int soc_probe_component(struct snd_soc_card *card,
 		snd_soc_component_get_dapm(component);
 	struct snd_soc_dai *dai;
 	int probed = 0;
-	int ret;
+	int ret = 0;
 
 	if (!strcmp(component->name, "snd-soc-dummy"))
 		return 0;
-- 
2.25.0.341.g760bfbb309-goog

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

             reply	other threads:[~2020-02-06 20:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-06 20:03 Jian Cai [this message]
2020-02-06 20:03 ` [alsa-devel] [PATCH] ASoC: soc-core: fix an uninitialized use Jian Cai
2020-02-06 23:28 ` Nick Desaulniers
2020-02-06 23:28   ` [alsa-devel] " Nick Desaulniers
2020-02-06 23:55   ` Jian Cai
2020-02-07  0:04     ` Nick Desaulniers
2020-02-07  0:04       ` [alsa-devel] " Nick Desaulniers
2020-02-07  0:19       ` Jian Cai

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=20200206200345.175344-1-caij2003@gmail.com \
    --to=caij2003@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.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 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.