Skip to content

Commit

Permalink
slob: Fix to return wrong pointer
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
MinChan Kim authored and Pekka Enberg committed May 19, 2008
1 parent f26a398 commit 239f49c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mm/slob.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 239f49c

Please sign in to comment.