Commit 22aaefd9 authored by Jaejoong Kim's avatar Jaejoong Kim Committed by Kleber Sacilotto de Souza

ALSA: usb-audio: Add check return value for usb_string()

BugLink: http://bugs.launchpad.net/bugs/1745047

commit 89b89d12 upstream.

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: default avatarJaejoong Kim <climbbb.kim@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent 44d4c9ef
...@@ -2106,12 +2106,13 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, ...@@ -2106,12 +2106,13 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid,
if (len) if (len)
; ;
else if (nameid) 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)); sizeof(kctl->id.name));
else { else
len = get_term_name(state, &state->oterm, len = get_term_name(state, &state->oterm,
kctl->id.name, sizeof(kctl->id.name), 0); kctl->id.name, sizeof(kctl->id.name), 0);
if (!len)
if (!len) {
strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name)); strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name));
if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR) if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment