diff options
author | Christoph Lameter <clameter@sgi.com> | 2007-07-17 13:03:22 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-17 19:23:01 +0200 |
commit | 6cb8f91320d3e720351c21741da795fed580b21b (patch) | |
tree | c9f73c8b82cd0f6c534939b8b9f36e8615b0ab2d /mm/util.c | |
parent | Slab allocators: consolidate code for krealloc in mm/util.c (diff) | |
download | linux-6cb8f91320d3e720351c21741da795fed580b21b.tar.xz linux-6cb8f91320d3e720351c21741da795fed580b21b.zip |
Slab allocators: consistent ZERO_SIZE_PTR support and NULL result semantics
Define ZERO_OR_NULL_PTR macro to be able to remove the checks from the
allocators. Move ZERO_SIZE_PTR related stuff into slab.h.
Make ZERO_SIZE_PTR work for all slab allocators and get rid of the
WARN_ON_ONCE(size == 0) that is still remaining in SLAB.
Make slub return NULL like the other allocators if a too large memory segment
is requested via __kmalloc.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/util.c')
-rw-r--r-- | mm/util.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/util.c b/mm/util.c index 18396ea63ee6..f2f21b775516 100644 --- a/mm/util.c +++ b/mm/util.c @@ -76,7 +76,7 @@ void *krealloc(const void *p, size_t new_size, gfp_t flags) if (unlikely(!new_size)) { kfree(p); - return NULL; + return ZERO_SIZE_PTR; } ks = ksize(p); |