From: Jaejoong Kim <climbbb.kim@gmail.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: Jaroslav Kysela <perex@perex.cz>, stable <stable@vger.kernel.org>,
alsa-devel@alsa-project.org, Jaejoong Kim <climbbb.kim@gmail.com>
Subject: [PATCH V2 2/2] ALSA: usb-audio: Add check return value for usb_string()
Date: Mon, 4 Dec 2017 15:31:49 +0900 [thread overview]
Message-ID: <1512369109-23253-3-git-send-email-climbbb.kim@gmail.com> (raw)
In-Reply-To: <1512369109-23253-1-git-send-email-climbbb.kim@gmail.com>
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>
---
Changes in V2:
- change return value check.
sound/usb/mixer.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 3294e3a..84b9f9c 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -2165,13 +2165,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");
--
2.7.4
next prev parent reply other threads:[~2017-12-04 6:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-28 0:36 [PATCH 0/3] ALSA: usb-audio: fix OOB and return value check Jaejoong Kim
2017-11-28 0:36 ` [PATCH 1/3] ALSA: usb-audio: Fix out-of-bound error Jaejoong Kim
2017-11-28 0:36 ` [PATCH 2/3] ALSA: usb-audio: Fix return value check for usb_string() Jaejoong Kim
2017-11-28 6:33 ` Takashi Iwai
2017-11-28 7:32 ` Jaejoong Kim
2017-11-28 0:36 ` [PATCH 3/3] ALSA: usb-audio: Add check return value " Jaejoong Kim
2017-12-04 6:31 ` [PATCH V2 0/2] ALSA: usb-audio: fix OOB and return value check Jaejoong Kim
2017-12-04 6:31 ` [PATCH V2 1/2] ALSA: usb-audio: Fix out-of-bound error Jaejoong Kim
2017-12-04 8:18 ` Takashi Iwai
2017-12-04 6:31 ` Jaejoong Kim [this message]
2017-12-04 8:18 ` [PATCH V2 2/2] ALSA: usb-audio: Add check return value for usb_string() 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=1512369109-23253-3-git-send-email-climbbb.kim@gmail.com \
--to=climbbb.kim@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=perex@perex.cz \
--cc=stable@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).