From: kirjanov@gmail.com Date: Sat, 15 May 2010 16:32:34 +0000 (-0400) Subject: lib/btree: fix possible NULL pointer dereference X-Git-Tag: Ubuntu-5.2.0-15.16~25205 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=43aa7ac736a4e21aae4882bd8f7c67403aed45b8;p=mirror_ubuntu-eoan-kernel.git lib/btree: fix possible NULL pointer dereference mempool_alloc() can return null in atomic case. Signed-off-by: Denis Kirjanov Cc: Joern Engel Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/lib/btree.c b/lib/btree.c index 41859a820218..c9c6f0351526 100644 --- a/lib/btree.c +++ b/lib/btree.c @@ -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; }