Received: by 10.223.185.116 with SMTP id b49csp6418008wrg; Wed, 28 Feb 2018 09:04:39 -0800 (PST) X-Google-Smtp-Source: AH8x224Kz0LxttvhY9Cu8Mh6qQo/NFBJAhIEoRShFlldGiv2toSrx0ueRsxxHKgG/NlWamYgYySn X-Received: by 2002:a17:902:550f:: with SMTP id f15-v6mr18468056pli.50.1519837478923; Wed, 28 Feb 2018 09:04:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519837478; cv=none; d=google.com; s=arc-20160816; b=HGecCXJ7E1Ciq77g1Lq7tq8DEMdEL0rEDqMblZMNTBmJRneCg72rt/aKh94g9JhrHm 44aXejoa2GX74CZB+LafB5oK8g2h9FhnoX2nodtV6nISGPjE/wLPujqPePEMxYACC8VP 0c1Hz8brfu7UlynyU5NguWlH7FZtv3JdS/vxM22EjAauyG79pgxomqEW4BOiCJy55yME z9d9w972aZG/L1ieFYAHF9vW+3xjHpiXYrTHboQ8/ZuMp5PjUw/Z/lah47vPBLFAaEJ7 kvmw8rf/Wpf01NmlkNijYgIyOQyz1zZT41wWVrDmFkJSTSrmJDgMnrPiTegVYy+uLMsy BjHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=2oubEHAXHkr+XS/P7MLpG3V/lQPwwiZiwW9kV7aPNow=; b=b9xABX3OK2JolsjW+fLajRqrfZGMmuh12rGI5g/UiCrqTCkpOy8huXf7t8xER3ptSB Ixekp4KiXSUXz5Te1nS43oxv9/Vz/rnV9n2vQjBNrsTxjRQLh9Doxu3JuPvxvkv4OF1E L6IupDpI4qltI91W7T8xnV5Cz8G3O9IFFsXwHtB7HfhhcG0uzRg0D24jSg1XNzm4Rq5G gz9uxvDzsctVIOb1c3gMJBv7Ru+db1bhN53uLdeZRQT252IOTN1svBkELeOIARcm8BbE d3em0hqBJeNq4F1QY9AHT2jxsbx5ElmFxexUefKi3ixlR9ZvX1v+V9OURMXMjWdNqJEi JFsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t11-v6si1542315plz.214.2018.02.28.09.04.13; Wed, 28 Feb 2018 09:04:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933898AbeB1RBA (ORCPT + 99 others); Wed, 28 Feb 2018 12:01:00 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34372 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933211AbeB1PwG (ORCPT ); Wed, 28 Feb 2018 10:52:06 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yu-0006Xe-6h; Wed, 28 Feb 2018 15:22:32 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Ye-0008Qu-De; Wed, 28 Feb 2018 15:22:16 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Jaejoong Kim" , "Takashi Iwai" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 050/254] ALSA: usb-audio: Add check return value for usb_string() In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Jaejoong Kim 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 Signed-off-by: Takashi Iwai Signed-off-by: Ben Hutchings --- sound/usb/mixer.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -2100,13 +2100,14 @@ static int parse_audio_selector_unit(str 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");