projects
/
platform
/
kernel
/
linux-arm64.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bdef2fe
)
lib/btree: fix possible NULL pointer dereference
author
kirjanov@gmail.com
<kirjanov@gmail.com>
Sat, 15 May 2010 16:32:34 +0000
(12:32 -0400)
committer
Linus 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
patch
|
blob
|
history
diff --git
a/lib/btree.c
b/lib/btree.c
index 41859a8202184e1006a53be2bf794ccc6420c755..c9c6f03515269aa78baad42ecf86f4d649a45a5c 100644
(file)
--- 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;
}