]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
slob: Fix to return wrong pointer
authorMinChan Kim <minchan.kim@gmail.com>
Mon, 19 May 2008 13:12:08 +0000 (22:12 +0900)
committerPekka Enberg <penberg@cs.helsinki.fi>
Mon, 19 May 2008 17:55:25 +0000 (20:55 +0300)
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>
mm/slob.c

index 6038cbadf796bb165a2b7bf7c9fbe707297f6f53..a3ad6671adf179daa38dae11a3963e5323ce0c91 100644 (file)
--- 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;