Skip to content

Commit

Permalink
[RFKILL]: Fix check for correct rfkill allocation
Browse files Browse the repository at this point in the history
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ivo van Doorn authored and David S. Miller committed May 19, 2007
1 parent c34b19f commit d007da1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/rfkill/rfkill.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d007da1

Please sign in to comment.