slab: warn on zero-length allocations
slub warns on this, and we're working on making kmalloc(0) return NULL. Let's make slab warn as well so our testers detect such callers more rapidly. Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
4b6f075045
commit
0b44f7a5b5
@@ -789,6 +789,7 @@ static inline struct kmem_cache *__find_general_cachep(size_t size,
|
|||||||
*/
|
*/
|
||||||
BUG_ON(malloc_sizes[INDEX_AC].cs_cachep == NULL);
|
BUG_ON(malloc_sizes[INDEX_AC].cs_cachep == NULL);
|
||||||
#endif
|
#endif
|
||||||
|
WARN_ON_ONCE(size == 0);
|
||||||
while (size > csizep->cs_size)
|
while (size > csizep->cs_size)
|
||||||
csizep++;
|
csizep++;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user