Commit 239f49c0 authored by MinChan Kim's avatar MinChan Kim Committed by Pekka Enberg

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: default avatarMatt Mackall <mpm@selenic.com>
Signed-off-by: default avatarMinChan Kim <minchan.kim@gmail.com>
Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
parent f26a3988
...@@ -469,8 +469,9 @@ void *__kmalloc_node(size_t size, gfp_t gfp, int node) ...@@ -469,8 +469,9 @@ void *__kmalloc_node(size_t size, gfp_t gfp, int node)
return ZERO_SIZE_PTR; return ZERO_SIZE_PTR;
m = slob_alloc(size + align, gfp, align, node); m = slob_alloc(size + align, gfp, align, node);
if (m) if (!m)
*m = size; return NULL;
*m = size;
return (void *)m + align; return (void *)m + align;
} else { } else {
void *ret; void *ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment