OSDN Git Service
(root)
/
tomoyo
/
tomoyo-test1.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
41859a8
..
c9c6f03
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;
}