From: hariconscious@gmail.com
To: perex@perex.cz, tiwai@suse.com, cristian.ciocaltea@collabora.com,
cryolitia@uniontech.com, franta-linux@frantovo.cz
Cc: khalid@kernel.org, shuah@kernel.org,
david.hunter.linux@gmail.com, linux-sound@vger.kernel.org,
linux-kernel@vger.kernel.org,
HariKrishna Sagala <hariconscious@gmail.com>,
Takashi Iwai <tiwai@suse.de>
Subject: [PATCH v2] ALSA: usb-audio: Initialize status1 to fix uninitialized symbol errors
Date: Thu, 4 Dec 2025 10:52:03 +0530 [thread overview]
Message-ID: <20251204052201.16286-3-hariconscious@gmail.com> (raw)
From: HariKrishna Sagala <hariconscious@gmail.com>
Initialize 'status1' with a default value to resolve the static analysis
smatch reported error "uninitialized symbol 'status1'".
The 'status1' variable is used to create a buff using "kmemdup".
So, ensure to initialize the value before it is read.
Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: HariKrishna Sagala <hariconscious@gmail.com>
---
This patch fixes the below smatch reported errors.
sound/usb/mixer_quirks.c:2462 snd_rme_rate_get() error: uninitialized symbol 'status1'.
sound/usb/mixer_quirks.c:2467 snd_rme_rate_get() error: uninitialized symbol 'status1'.
sound/usb/mixer_quirks.c:2472 snd_rme_rate_get() error: uninitialized symbol 'status1'.
sound/usb/mixer_quirks.c:2495 snd_rme_sync_state_get() error: uninitialized symbol 'status1'.
sound/usb/mixer_quirks.c:2501 snd_rme_sync_state_get() error: uninitialized symbol 'status1'.
sound/usb/mixer_quirks.c:2522 snd_rme_spdif_if_get() error: uninitialized symbol 'status1'.
sound/usb/mixer_quirks.c:2535 snd_rme_spdif_format_get() error: uninitialized symbol 'status1'.
sound/usb/mixer_quirks.c:2548 snd_rme_sync_source_get() error: uninitialized symbol 'status1'.
The below is the flow of 'status1' it is used before initialization.
snd_rme_rate_get -> status1 is uninitialized and passed
snd_rme_get_status1 -> passed as is
snd_rme_read_value -> passed as is
snd_usb_ctl_msg -> created buf from status1 using kmemdup
usb_control_msg -> sent buf for reading/writing
Description of "usb_control_msg", states as
" * @data: pointer to the data to send"
Later from Usb control request, dst buf is copied to src buf but usb
control msg request is made before initialization.
All the above warning reported functions, call snd_rme_get_status1().
v2:
Corrected as suggested by Takashi Iwai to silence the warnings
from callee side as it can reduce number of changes.
v1:
https://lore.kernel.org/all/20251203083319.58555-2-hariconscious@gmail.com/
Thank you.
sound/usb/mixer_quirks.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 828af3095b86..f3e15825bc02 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -2440,6 +2440,7 @@ static int snd_rme_get_status1(struct snd_kcontrol *kcontrol,
struct usb_mixer_elem_list *list = snd_kcontrol_chip(kcontrol);
struct snd_usb_audio *chip = list->mixer->chip;
+ *status1 = 0;
CLASS(snd_usb_lock, pm)(chip);
if (pm.err < 0)
return pm.err;
base-commit: 4a26e7032d7d57c998598c08a034872d6f0d3945
--
2.43.0
next reply other threads:[~2025-12-04 5:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-04 5:22 hariconscious [this message]
2025-12-05 14:28 ` [PATCH v2] ALSA: usb-audio: Initialize status1 to fix uninitialized symbol errors Takashi Iwai
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=20251204052201.16286-3-hariconscious@gmail.com \
--to=hariconscious@gmail.com \
--cc=cristian.ciocaltea@collabora.com \
--cc=cryolitia@uniontech.com \
--cc=david.hunter.linux@gmail.com \
--cc=franta-linux@frantovo.cz \
--cc=khalid@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=shuah@kernel.org \
--cc=tiwai@suse.com \
--cc=tiwai@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox