summaryrefslogtreecommitdiffstats
path: root/sound/usb/mixer.c
diff options
context:
space:
mode:
authorJaejoong Kim <climbbb.kim@gmail.com>2017-12-04 07:31:49 +0100
committerTakashi Iwai <tiwai@suse.de>2017-12-04 09:15:55 +0100
commit89b89d121ffcf8d9546633b98ded9d18b8f75891 (patch)
treed1e027d564b848364fc4238249995fe9c8d0ed22 /sound/usb/mixer.c
parentALSA: usb-audio: Fix out-of-bound error (diff)
downloadlinux-89b89d121ffcf8d9546633b98ded9d18b8f75891.tar.xz
linux-89b89d121ffcf8d9546633b98ded9d18b8f75891.zip
ALSA: usb-audio: Add check return value for usb_string()
snd_usb_copy_string_desc() returns zero if usb_string() fails. In case of failure, we need to check the snd_usb_copy_string_desc()'s return value and add an exception case Signed-off-by: Jaejoong Kim <climbbb.kim@gmail.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/mixer.c')
-rw-r--r--sound/usb/mixer.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 8e18f7ec51f4..afc208e1c756 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -2178,13 +2178,14 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid,
if (len)
;
else if (nameid)
- snd_usb_copy_string_desc(state, nameid, kctl->id.name,
+ len = snd_usb_copy_string_desc(state, nameid, kctl->id.name,
sizeof(kctl->id.name));
- else {
+ else
len = get_term_name(state, &state->oterm,
kctl->id.name, sizeof(kctl->id.name), 0);
- if (!len)
- strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name));
+
+ if (!len) {
+ strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name));
if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR)
append_ctl_name(kctl, " Clock Source");