Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1025434ybe; Wed, 4 Sep 2019 11:19:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRpCPwa5D62Rx5otGUkQ++Z1Buwq2Zq6O+rOx1GPK6730QiSIc1qs97THb9WZL8pGGDnBU X-Received: by 2002:a17:90a:9f91:: with SMTP id o17mr6441936pjp.103.1567621197732; Wed, 04 Sep 2019 11:19:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567621197; cv=none; d=google.com; s=arc-20160816; b=PaBniBt29H8AgjhnUgz8VWUlfNI2i8DpVcRuHh2wAAMKPOQ/6Ll70+WoCv/P92anrI 44beoC75S+dFtGsM5PqfbFNsI1BTGce5wQwUNndHSDhGo9ZcB6YyG/JTSyDRAUp4Ytu9 VNETsanvBPe/ppfUCHsZkggj+GQnMKRlvro9CqHvs0BzO+4MDCcbSiZSh4q2B9Wj9Ywm YN6SGqqGGjm4yiEDy0yJlrQq/VOOPA6caHXyvl+wANFeK8yqYVRsIG1yziSE5ksEWWVT tfC8SNniUKZUuTqNDpATKz9bpQRhZk14M4B8VJ/rKph8ViRYl5lXeC7Zj/nVM9SjUib2 4BIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7KBTj+5H3sLfxENx3lL/t65Gv22cxTR8JCB7LU9ZYV4=; b=bW0IGfzVQu5Pzyg9SKbxjOBObyx9c4/bc3iWcW+4nlA7OEMyFblf5Mvbh3gNLL9ETL d1/GXa7rucdXqecPmyfabDAYGQnFzv4cG5VBzyhyWyQb3yORqsuUsekEuGUNJrX8iJ5l pJn3cME3bOq2sXoVSwpUZWDS9e4jchdSG6yD/yP7Z4Ge5TElMGiUYbquteCuYwkF7Kvs 24lZ8+l30z2Qno9DEKFIQKmzIAEyKeNBENJwUtoNxRc68KreqQ7xOQIALoRt/2oH0wV5 x8qUL2xafin//GjbDM1ctDpX/wVTxLs+ORUoQ06SQDKd2cBuKvpFQvoUv5gZXRBWl5rL muDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YcR7kqhD; 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 f12si6806098plt.227.2019.09.04.11.19.42; Wed, 04 Sep 2019 11:19:57 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=YcR7kqhD; 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 S2390048AbfIDSSD (ORCPT + 99 others); Wed, 4 Sep 2019 14:18:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:55922 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388806AbfIDSLq (ORCPT ); Wed, 4 Sep 2019 14:11:46 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7DE9322DBF; Wed, 4 Sep 2019 18:11:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567620705; bh=khsVp9cYfjAoDIzzdFzI30k+Zpgo/KBMB8i/V8V/Kx4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YcR7kqhDX02s4ehywRrgZWCMZERdQqiIa52VRnp0wBVxSeX/r7GbjWjZ3QAyXyTgZ yBdMMUHrK4sHFcDRwCJPmorpOb0C5o1I5r45kFfWclbJHvgH8za+8Vp9yeXITrZq8K BN87+6Hw98Ee4WZWt+CEcSLp7JQX7nga8UV7UQNA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.2 065/143] ALSA: usb-audio: Fix invalid NULL check in snd_emuusb_set_samplerate() Date: Wed, 4 Sep 2019 19:53:28 +0200 Message-Id: <20190904175316.613456974@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175314.206239922@linuxfoundation.org> References: <20190904175314.206239922@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Iwai commit 6de3c9e3f6b3eaf66859e1379b3f35dda781416b upstream. The quirk function snd_emuusb_set_samplerate() has a NULL check for the mixer element, but this is useless in the current code. It used to be a check against mixer->id_elems[unitid] but it was changed later to the value after mixer_eleme_list_to_info() which is always non-NULL due to the container_of() usage. This patch fixes the check before the conversion. While we're at it, correct a typo in the comment in the function, too. Fixes: 8c558076c740 ("ALSA: usb-audio: Clean up mixer element list traverse") Cc: Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/mixer_quirks.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/sound/usb/mixer_quirks.c +++ b/sound/usb/mixer_quirks.c @@ -1155,17 +1155,17 @@ void snd_emuusb_set_samplerate(struct sn { struct usb_mixer_interface *mixer; struct usb_mixer_elem_info *cval; - int unitid = 12; /* SamleRate ExtensionUnit ID */ + int unitid = 12; /* SampleRate ExtensionUnit ID */ list_for_each_entry(mixer, &chip->mixer_list, list) { - cval = mixer_elem_list_to_info(mixer->id_elems[unitid]); - if (cval) { + if (mixer->id_elems[unitid]) { + cval = mixer_elem_list_to_info(mixer->id_elems[unitid]); snd_usb_mixer_set_ctl_value(cval, UAC_SET_CUR, cval->control << 8, samplerate_id); snd_usb_mixer_notify_id(mixer, unitid); + break; } - break; } }