diff options
author | Jaejoong Kim <climbbb.kim@gmail.com> | 2017-12-04 15:31:49 +0900 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-12-16 10:32:27 +0100 |
commit | 7a3638bbec14afafd3322c7fc2f68cfad0ac3550 (patch) | |
tree | 8530dd5dbdce6c1f5760a5b34b79be6360389a41 /sound | |
parent | 13de9b240ad98b69ce182237e8f4193f8df159e8 (diff) | |
download | linux-stable-7a3638bbec14afafd3322c7fc2f68cfad0ac3550.tar.gz linux-stable-7a3638bbec14afafd3322c7fc2f68cfad0ac3550.tar.bz2 linux-stable-7a3638bbec14afafd3322c7fc2f68cfad0ac3550.zip |
ALSA: usb-audio: Add check return value for usb_string()
commit 89b89d121ffcf8d9546633b98ded9d18b8f75891 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: Jaejoong Kim <climbbb.kim@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/usb/mixer.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 4e780d59a995..92ad24ef1c5b 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -2099,13 +2099,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"); |