Skip to content

Commit

Permalink
lib/btree: fix possible NULL pointer dereference
Browse files Browse the repository at this point in the history
mempool_alloc() can return null in atomic case.

Signed-off-by: Denis Kirjanov <kirjanov@gmail.com>
Cc: Joern Engel <joern@logfs.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
kda88 authored and torvalds committed May 15, 2010
1 parent bdef2fe commit 43aa7ac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ static unsigned long *btree_node_alloc(struct btree_head *head, gfp_t gfp)
unsigned long *node;

node = mempool_alloc(head->mempool, gfp);
memset(node, 0, NODESIZE);
if (likely(node))
memset(node, 0, NODESIZE);
return node;
}

Expand Down

0 comments on commit 43aa7ac

Please sign in to comment.