summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorMinChan Kim <minchan.kim@gmail.com>2008-05-19 15:12:08 +0200
committerPekka Enberg <penberg@cs.helsinki.fi>2008-05-19 19:55:25 +0200
commit239f49c0800778c863585a103805c58afbad6748 (patch)
treebc49ae2d4405b4431e6e7463b3eac52245793a02 /mm
parentMerge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/... (diff)
downloadlinux-239f49c0800778c863585a103805c58afbad6748.tar.xz
linux-239f49c0800778c863585a103805c58afbad6748.zip
slob: Fix to return wrong pointer
Although slob_alloc return NULL, __kmalloc_node returns NULL + align. Because align always can be changed, it is very hard for debugging problem of no page if it don't return NULL. We have to return NULL in case of no page. [penberg@cs.helsinki.fi: fix formatting as suggested by Matt.] Acked-by: Matt Mackall <mpm@selenic.com> Signed-off-by: MinChan Kim <minchan.kim@gmail.com> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Diffstat (limited to 'mm')
-rw-r--r--mm/slob.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mm/slob.c b/mm/slob.c
index 6038cbadf796..a3ad6671adf1 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -469,8 +469,9 @@ void *__kmalloc_node(size_t size, gfp_t gfp, int node)
return ZERO_SIZE_PTR;
m = slob_alloc(size + align, gfp, align, node);
- if (m)
- *m = size;
+ if (!m)
+ return NULL;
+ *m = size;
return (void *)m + align;
} else {
void *ret;