From: Ivo van Doorn Date: Sat, 19 May 2007 19:24:39 +0000 (-0700) Subject: [RFKILL]: Fix check for correct rfkill allocation X-Git-Tag: v2.6.22-rc3~111^2~8 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d007da1fa6f0ad5e01ceae4a1f60cdbb23ecd706;p=linux-2.6 [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 Signed-off-by: David S. Miller --- diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c index a973603e38..f3986d498b 100644 --- a/net/rfkill/rfkill.c +++ b/net/rfkill/rfkill.c @@ -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);