]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
lib/btree: fix possible NULL pointer dereference
authorkirjanov@gmail.com <kirjanov@gmail.com>
Sat, 15 May 2010 16:32:34 +0000 (12:32 -0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 15 May 2010 19:48:10 +0000 (12:48 -0700)
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>
lib/btree.c

index 41859a8202184e1006a53be2bf794ccc6420c755..c9c6f03515269aa78baad42ecf86f4d649a45a5c 100644 (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;
 }