mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ALSA: ac97: Fix possible NULL dereference in snd_ac97_mixer
@ 2023-06-15  2:17 Su Hui
  2023-06-15  6:41 ` Takashi Iwai
  2023-08-22 20:07 ` Christophe JAILLET
  0 siblings, 2 replies; 6+ messages in thread
From: Su Hui @ 2023-06-15  2:17 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai
  Cc: Arnd Bergmann, maciej.szmigiero, yangyingliang, alsa-devel,
	linux-kernel, kernel-janitors, Su Hui

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@nfschina.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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-08-23 17:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-15  2:17 [PATCH] ALSA: ac97: Fix possible NULL dereference in snd_ac97_mixer Su Hui
2023-06-15  6:41 ` Takashi Iwai
2023-08-22 20:07 ` Christophe JAILLET
2023-08-23  1:24   ` Su Hui
2023-08-23 14:37   ` Takashi Iwai
2023-08-23 17:18     ` Christophe JAILLET

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®