summaryrefslogtreecommitdiffstats
path: root/mm/fremap.c
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2007-06-08 13:46:49 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-08 17:23:33 -0700
commit272c1d21d6fe42979068e14c04fb60fb6045ad74 (patch)
tree6a365c67ed8575d15a59aa2183df609368359724 /mm/fremap.c
parenta17627ef8833ac30622a7b39b7be390e1b174405 (diff)
downloadop-kernel-dev-272c1d21d6fe42979068e14c04fb60fb6045ad74.zip
op-kernel-dev-272c1d21d6fe42979068e14c04fb60fb6045ad74.tar.gz
SLUB: return ZERO_SIZE_PTR for kmalloc(0)
Instead of returning the smallest available object return ZERO_SIZE_PTR. A ZERO_SIZE_PTR can be legitimately used as an object pointer as long as it is not deferenced. The dereference of ZERO_SIZE_PTR causes a distinctive fault. kfree can handle a ZERO_SIZE_PTR in the same way as NULL. This enables functions to use zero sized object. e.g. n = number of objects. objects = kmalloc(n * sizeof(object)); for (i = 0; i < n; i++) objects[i].x = y; kfree(objects); 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/fremap.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud