[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230615021732.1972194-1-suhui@nfschina.com>
Date: Thu, 15 Jun 2023 10:17:32 +0800
From: Su Hui <suhui@...china.com>
To: Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>
Cc: Arnd Bergmann <arnd@...db.de>, maciej.szmigiero@...cle.com,
yangyingliang@...wei.com, alsa-devel@...a-project.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
Su Hui <suhui@...china.com>
Subject: [PATCH] ALSA: ac97: Fix possible NULL dereference in snd_ac97_mixer
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 <suhui@...china.com>
---
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 9afc5906d662..80a65b8ad7b9 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -2069,8 +2069,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.30.2
Powered by blists - more mailing lists