From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A0C41F94B for ; Fri, 21 Jul 2023 18:59:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F298CC433C7; Fri, 21 Jul 2023 18:59:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1689965961; bh=2f1mDZaPCVIep0BxXdNZPeekjlv/oElBRFQ5P+U2C3Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NQDxV69cGr0Imyb2/KaQjpDH/cHCfJCf+9ZG5fJTGCTTCbVcdKc28xjfZGtveLZEm YdvGd/cbVNqCtBPqDuUujfpjSpZZnc7Bs8UcmRtCZ12gwYyaXD8ug1xX5nCaL9F/wh o+WySEpwj0f67qx1wm1zGPWI5YMJ3M4UH+fBsFxQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Su Hui , Takashi Iwai , Sasha Levin Subject: [PATCH 5.15 176/532] ALSA: ac97: Fix possible NULL dereference in snd_ac97_mixer Date: Fri, 21 Jul 2023 18:01:20 +0200 Message-ID: <20230721160623.935545628@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230721160614.695323302@linuxfoundation.org> References: <20230721160614.695323302@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Su Hui [ Upstream commit 79597c8bf64ca99eab385115743131d260339da5 ] smatch error: sound/pci/ac97/ac97_codec.c:2354 snd_ac97_mixer() error: we previously assumed 'rac97' could be null (see line 2072) remove redundant assignment, return error if rac97 is NULL. Fixes: da3cec35dd3c ("ALSA: Kill snd_assert() in sound/pci/*") Signed-off-by: Su Hui Link: https://lore.kernel.org/r/20230615021732.1972194-1-suhui@nfschina.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/ac97/ac97_codec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index ceead55f13ab1..58ae0c3ce1e49 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -2070,8 +2070,8 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, .dev_disconnect = snd_ac97_dev_disconnect, }; - if (rac97) - *rac97 = NULL; + if (!rac97) + return -EINVAL; if (snd_BUG_ON(!bus || !template)) return -EINVAL; if (snd_BUG_ON(template->num >= 4)) -- 2.39.2