staging: fix possible use-before-NULL-check crash
PATCH 1/1 staging: fix possible use-before-NULL-check crash
Found via http://coccinelle.lip6.fr/rules/mini_null_ref.cocci
Signed-off-by Kees Cook <[email protected]>
--- drivers/staging/tm6000/tm6000-alsa.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/staging/tm6000/tm6000-alsa.c +2 -1
@@ -426,10 +426,11 @@ error:static int tm6000_audio_fini (struct tm6000_core *dev) { -struct snd_tm6000_card *chip = dev->adev; +struct snd_tm6000_card *chip;if (!dev)return 0 ; + chip = dev->adev;if (!chip)return 0 ;
Signature · 6 lines
1.7.1 -- Kees Cook Ubuntu Security Team
Quoted 12 lines · Kees Cook
Found via http://coccinelle.lip6.fr/rules/mini_null_ref.cocci
Signed-off-by Kees Cook <[email protected]>--- drivers/staging/tm6000/tm6000-alsa.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)drivers/staging/tm6000/tm6000-alsa.c +0
-0
drivers/staging/tm6000/tm6000-alsa.c error: · line 433
Quoted 9 lines
drivers/staging/tm6000/tm6000-alsa.c +2
-1@@ -426,10 +426,11 @@ error:static int tm6000_audio_fini (struct tm6000_core *dev) { -struct snd_tm6000_card *chip = dev->adev; +struct snd_tm6000_card *chip;if (!dev)return 0 ; + chip = dev->adev;
Nice catch, but I don't think that the dev pointer can ever be NULL here.
Mauro, can you queue this up through your tree, as you handle this one?
thanks,
greg k-h
Hi Greg,
Quoted 2 lines · Greg KH
Nice catch, but I don't think that the dev pointer can ever be NULL here.
Yeah, I didn't think so either, but figured it was best to fix it anyway.
-Kees
Signature · 2 lines
Kees Cook Ubuntu Security Team