diff options
author | kirjanov@gmail.com <kirjanov@gmail.com> | 2010-05-15 18:32:34 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-15 21:48:10 +0200 |
commit | 43aa7ac736a4e21aae4882bd8f7c67403aed45b8 (patch) | |
tree | 8ebbe9c6053c6552de8ee120384afb1b02bf8f47 /lib/btree.c | |
parent | mmc: at91_mci: modify cache flush routines (diff) | |
download | linux-43aa7ac736a4e21aae4882bd8f7c67403aed45b8.tar.xz linux-43aa7ac736a4e21aae4882bd8f7c67403aed45b8.zip |
lib/btree: fix possible NULL pointer dereference
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>
Diffstat (limited to '')
-rw-r--r-- | lib/btree.c | 3 |
1 files changed, 2 insertions, 1 deletions
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; } |