lib/btree: fix possible NULL pointer dereference

mempool_alloc() can return null in atomic case.

Signed-off-by: Denis Kirjanov <[email protected]>
Cc: Joern Engel <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
[email protected] authored and Linus Torvalds committed 2010-05-15 12:48:10 -07:00
1 parent bdef2fe88b
commit 43aa7ac736
1 file changed
+2 -1
+2 -1
View File
@@ -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;
}