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:
Christoph Lameter 2007-05-16 22:10:53 -07:00 коммит произвёл Linus Torvalds
Родитель 4b6f075045
Коммит 0b44f7a5b5
1 изменённых файлов: 1 добавлений и 0 удалений

Просмотреть файл

@ -789,6 +789,7 @@ static inline struct kmem_cache *__find_general_cachep(size_t size,
*/
BUG_ON(malloc_sizes[INDEX_AC].cs_cachep == NULL);
#endif
WARN_ON_ONCE(size == 0);
while (size > csizep->cs_size)
csizep++;