From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14902C433F5 for ; Sun, 27 Mar 2022 08:33:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235667AbiC0IfE (ORCPT ); Sun, 27 Mar 2022 04:35:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235249AbiC0IfA (ORCPT ); Sun, 27 Mar 2022 04:35:00 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4855C75; Sun, 27 Mar 2022 01:33:20 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 522D31F37E; Sun, 27 Mar 2022 08:33:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1648369999; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=myygfWV2gji2sVzB/Ye7kUXJNfCLEl+buBuzzVe5i70=; b=eSvuRHdWaMDrLyAnxWuwpHOn7va2zkCT6lNhrwtH8LvtFy/AI6OM9yl4KhWbpN14x0d/cZ v1/0bDGWneep+P7H4Ts9DKNqr+Ktd/6fRmc9mFRFBTW4P9OVzqWNbCNLJrrL4iixCS/fS4 KJzCFuMvtQu5hN+o+2O4VrU7Wmz0VDo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1648369999; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=myygfWV2gji2sVzB/Ye7kUXJNfCLEl+buBuzzVe5i70=; b=VjjNVsOAbe4JFoT7TbMeolhiaWLgGwQN3Z/FQ/AIPFJp3L1IDGF48fajcnUqqAY4+yfXcA 8eq8bfMmdqdvyYBQ== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 2633DA3B82; Sun, 27 Mar 2022 08:33:19 +0000 (UTC) Date: Sun, 27 Mar 2022 10:33:19 +0200 Message-ID: From: Takashi Iwai To: Xiaomeng Tong Cc: perex@perex.cz, tiwai@suse.com, krzysztof.h1@wp.pl, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] cs423x: cs4236: fix an incorrect NULL check on list iterator In-Reply-To: <20220327060822.4735-1-xiam0nd.tong@gmail.com> References: <20220327060822.4735-1-xiam0nd.tong@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 27 Mar 2022 08:08:22 +0200, Xiaomeng Tong wrote: > > The bug is here: > err = snd_card_cs423x_pnp(dev, card->private_data, pdev, cdev); > > The list iterator value 'cdev' will *always* be set and non-NULL > by list_for_each_entry(), so it is incorrect to assume that the > iterator value will be NULL if the list is empty or no element > is found. > > To fix the bug, use a new variable 'iter' as the list iterator, > while use the original variable 'cdev' as a dedicated pointer > to point to the found element. And snd_card_cs423x_pnp() itself > has NULL check for cdev. > > Cc: stable@vger.kernel.org > Fixes: c2b73d1458014 ("ALSA: cs4236: cs4232 and cs4236 driver merge to solve PnP BIOS detection") > Signed-off-by: Xiaomeng Tong Thanks, applied now. Takashi