diff options
author | Tom Rix <trix@redhat.com> | 2022-01-26 19:21:42 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2022-01-27 14:41:16 +0100 |
commit | 3da4b7403db87d39bc2613cfd790de1de99a70ab (patch) | |
tree | d12b7049dedf9cb82c8664ebae646da8f05d3c3d /sound | |
parent | ALSA: hda: Fix UAF of leds class devs at unbinding (diff) | |
download | linux-3da4b7403db87d39bc2613cfd790de1de99a70ab.tar.xz linux-3da4b7403db87d39bc2613cfd790de1de99a70ab.zip |
ALSA: usb-audio: initialize variables that could ignore errors
clang static analysis reports this representative issue
mixer.c:1548:35: warning: Assigned value is garbage or undefined
ucontrol->value.integer.value[0] = val;
^ ~~~
The filter_error() macro allows errors to be ignored.
If errors can be ignored, initialize variables
so garbage will not be used.
Fixes: 48cc42973509 ("ALSA: usb-audio: Filter error from connector kctl ops, too")
Signed-off-by: Tom Rix <trix@redhat.com>
Link: https://lore.kernel.org/r/20220126182142.1184819-1-trix@redhat.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/usb/mixer.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index e8f3f8d622ec..630766ba259f 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -1527,6 +1527,10 @@ error: usb_audio_err(chip, "cannot get connectors status: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", UAC_GET_CUR, validx, idx, cval->val_type); + + if (val) + *val = 0; + return filter_error(cval, ret); } |