netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rfkill: Fix check for correct rfkill allocation
@ 2007-05-19 12:08 Ivo van Doorn
  2007-05-19 18:34 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Ivo van Doorn @ 2007-05-19 12:08 UTC (permalink / raw)
  To: davem; +Cc: Eric Sesterhenn / Snakebyte, Dmitry Torokhov, netdev, akpm

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 <IvDoorn@gmail.com>

---

diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index a973603..f3986d4 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);

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

end of thread, other threads:[~2007-05-19 18:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-19 12:08 [PATCH] rfkill: Fix check for correct rfkill allocation Ivo van Doorn
2007-05-19 18:34 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).