]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
slub: fix ksize() for zero-sized pointers
authorLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 19 Jul 2007 20:21:34 +0000 (13:21 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 19 Jul 2007 20:21:34 +0000 (13:21 -0700)
The slab and slob allocators already did this right, but slub would call
"get_object_page()" on the magic ZERO_SIZE_PTR, with all kinds of nasty
end results.

Noted by Ingo Molnar.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Christoph Lameter <clameter@sgi.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/slub.c

index 52a4f44be39463500f3e1a51283d8a6670762c37..322f3a5d72c702523a0a2834baea1d68dd67bb4d 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2394,7 +2394,7 @@ size_t ksize(const void *object)
        struct page *page;
        struct kmem_cache *s;
 
-       if (object == ZERO_SIZE_PTR)
+       if (ZERO_OR_NULL_PTR(object))
                return 0;
 
        page = get_object_page(object);