Commit 239f49c0800778c863585a103805c58afbad6748

Authored by MinChan Kim
Committed by Pekka Enberg
1 parent f26a398891

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>

Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff

... ... @@ -469,8 +469,9 @@
469 469 return ZERO_SIZE_PTR;
470 470  
471 471 m = slob_alloc(size + align, gfp, align, node);
472   - if (m)
473   - *m = size;
  472 + if (!m)
  473 + return NULL;
  474 + *m = size;
474 475 return (void *)m + align;
475 476 } else {
476 477 void *ret;