Slab allocators: fail if ksize is called with a NULL parameter
authorChristoph Lameter <clameter@sgi.com>
Tue, 16 Oct 2007 08:24:46 +0000 (01:24 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 16 Oct 2007 16:42:53 +0000 (09:42 -0700)
commitef8b4520bd9f8294ffce9abd6158085bde5dc902
treec099a16691ac06208f4d3d65b71e7adaf7361fcd
parent0da7e01f5f37f441cccd7c8c0586e06db0981907
Slab allocators: fail if ksize is called with a NULL parameter

A NULL pointer means that the object was not allocated.  One cannot
determine the size of an object that has not been allocated.  Currently we
return 0 but we really should BUG() on attempts to determine the size of
something nonexistent.

krealloc() interprets NULL to mean a zero sized object.  Handle that
separately in krealloc().

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/slab.c
mm/slob.c
mm/slub.c
mm/util.c