mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
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 <[email protected]> Acked-by: Pekka Enberg <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
ef2ad80c7d
commit
6cb8f91320
7 changed files with 57 additions and 35 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue