mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
[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 <IvDoorn@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c34b19fb4e
commit
d007da1fa6
1 changed files with 1 additions and 1 deletions
|
@ -296,7 +296,7 @@ struct rfkill *rfkill_allocate(struct device *parent, enum rfkill_type type)
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
|
|
||||||
rfkill = kzalloc(sizeof(struct rfkill), GFP_KERNEL);
|
rfkill = kzalloc(sizeof(struct rfkill), GFP_KERNEL);
|
||||||
if (rfkill)
|
if (!rfkill)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
mutex_init(&rfkill->mutex);
|
mutex_init(&rfkill->mutex);
|
||||||
|
|
Loading…
Add table
Reference in a new issue