Commit 43aa7ac7 authored by kirjanov@gmail.com's avatar kirjanov@gmail.com Committed by Linus Torvalds

lib/btree: fix possible NULL pointer dereference

mempool_alloc() can return null in atomic case.
Signed-off-by: default avatarDenis Kirjanov <kirjanov@gmail.com>
Cc: Joern Engel <joern@logfs.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent bdef2fe8
...@@ -95,6 +95,7 @@ static unsigned long *btree_node_alloc(struct btree_head *head, gfp_t gfp) ...@@ -95,6 +95,7 @@ static unsigned long *btree_node_alloc(struct btree_head *head, gfp_t gfp)
unsigned long *node; unsigned long *node;
node = mempool_alloc(head->mempool, gfp); node = mempool_alloc(head->mempool, gfp);
if (likely(node))
memset(node, 0, NODESIZE); memset(node, 0, NODESIZE);
return node; return node;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment