Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=294a80a8ed004b383ab214837e1c05ca4098a717
Commit:     294a80a8ed004b383ab214837e1c05ca4098a717
Parent:     5a622f2d0f86b316b07b55a4866ecb5518dd1cf7
Author:     Vegard Nossum <[EMAIL PROTECTED]>
AuthorDate: Tue Dec 4 23:45:30 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed Dec 5 09:21:20 2007 -0800

    SLUB's ksize() fails for size > 2048
    
    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 <[EMAIL PROTECTED]>
    Tested-by: Tetsuo Handa <[EMAIL PROTECTED]>
    Cc: Christoph Lameter <[EMAIL PROTECTED]>, Matt Mackall <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 mm/slub.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 9acb413..b9f37cb 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2558,8 +2558,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);
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to