rfkill: Fix check for correct rfkill allocation
Subsystems (3)
PATCH 1/1 rfkill: Fix check for correct rfkill allocation
coverity has spotted a bug in rfkill.c (bug id #1627), in rfkill_allocate() NULL was returns if the kzalloc() works, and deref the NULL pointer if it fails,
Signed-off-by Ivo van Doorn <[email protected]>
---
net/rfkill/rfkill.c +1 -1
@@ -296,7 +296,7 @@ struct rfkill *rfkill_allocate(struct device *parent, enum rfkill_type type)struct device *dev; rfkill =kzalloc (sizeof (struct rfkill ),GFP_KERNEL ); -if (rfkill) +if (!rfkill)return NULL ;mutex_init (&rfkill->mutex);
David Miller
maintainerFrom: Ivo van Doorn <[email protected]>
Date: Sat, 19 May 2007 14:08:43 +0200
Quoted 5 lines
coverity has spotted a bug in
rfkill.c(bug id #1627), inrfkill_allocate()NULL was returns if thekzalloc()works, and deref the NULL pointer if it fails,Signed-off-by Ivo van Doorn <[email protected]>
I really wonder how well tested this rfkill code is if the object allocation is so busted like this :-/
I'll apply your patch, thank you.