The patch titled SLUB's ksize() fails for size > 2048 has been added to the -mm tree. Its filename is slubs-ksize-fails-for-size-2048.patch *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: SLUB's ksize() fails for size > 2048 From: "Vegard Nossum" <vegard.nossum@xxxxxxxxx> I can't pass memory allocated by kmalloc() to ksize() if it is allocated by SLUB allocator and size is larger than (I guess) PAGE_SIZE / 2. The error of ksize() seems to be that it does not check if the allocation was made by SLUB or the page allocator. Reviewed-by: Pekka Enberg <penberg@xxxxxxxxxxxxxx> Tested-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> Cc: Christoph Lameter <clameter@xxxxxxx>, Matt Mackall <mpm@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/slub.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff -puN mm/slub.c~slubs-ksize-fails-for-size-2048 mm/slub.c --- a/mm/slub.c~slubs-ksize-fails-for-size-2048 +++ a/mm/slub.c @@ -2724,8 +2724,12 @@ size_t ksize(const void *object) if (unlikely(object == ZERO_SIZE_PTR)) return 0; - page = get_object_page(object); + page = virt_to_head_page(object); BUG_ON(!page); + + if (unlikely(!PageSlab(page))) + return PAGE_SIZE << compound_order(page); + s = page->slab; BUG_ON(!s); _ Patches currently in -mm which might be from vegard.nossum@xxxxxxxxx are slubs-ksize-fails-for-size-2048.patch fat-fix-printk-format-strings.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html