diff options
-rw-r--r-- | mm/slub.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -2610,19 +2610,17 @@ size_t ksize(const void *object) | |||
2610 | struct page *page; | 2610 | struct page *page; |
2611 | struct kmem_cache *s; | 2611 | struct kmem_cache *s; |
2612 | 2612 | ||
2613 | BUG_ON(!object); | ||
2614 | if (unlikely(object == ZERO_SIZE_PTR)) | 2613 | if (unlikely(object == ZERO_SIZE_PTR)) |
2615 | return 0; | 2614 | return 0; |
2616 | 2615 | ||
2617 | page = virt_to_head_page(object); | 2616 | page = virt_to_head_page(object); |
2618 | BUG_ON(!page); | ||
2619 | 2617 | ||
2620 | if (unlikely(!PageSlab(page))) | 2618 | if (unlikely(!PageSlab(page))) |
2621 | return PAGE_SIZE << compound_order(page); | 2619 | return PAGE_SIZE << compound_order(page); |
2622 | 2620 | ||
2623 | s = page->slab; | 2621 | s = page->slab; |
2624 | BUG_ON(!s); | ||
2625 | 2622 | ||
2623 | #ifdef CONFIG_SLUB_DEBUG | ||
2626 | /* | 2624 | /* |
2627 | * Debugging requires use of the padding between object | 2625 | * Debugging requires use of the padding between object |
2628 | * and whatever may come after it. | 2626 | * and whatever may come after it. |
@@ -2630,6 +2628,7 @@ size_t ksize(const void *object) | |||
2630 | if (s->flags & (SLAB_RED_ZONE | SLAB_POISON)) | 2628 | if (s->flags & (SLAB_RED_ZONE | SLAB_POISON)) |
2631 | return s->objsize; | 2629 | return s->objsize; |
2632 | 2630 | ||
2631 | #endif | ||
2633 | /* | 2632 | /* |
2634 | * If we have the need to store the freelist pointer | 2633 | * If we have the need to store the freelist pointer |
2635 | * back there or track user information then we can | 2634 | * back there or track user information then we can |
@@ -2637,7 +2636,6 @@ size_t ksize(const void *object) | |||
2637 | */ | 2636 | */ |
2638 | if (s->flags & (SLAB_DESTROY_BY_RCU | SLAB_STORE_USER)) | 2637 | if (s->flags & (SLAB_DESTROY_BY_RCU | SLAB_STORE_USER)) |
2639 | return s->inuse; | 2638 | return s->inuse; |
2640 | |||
2641 | /* | 2639 | /* |
2642 | * Else we can use all the padding etc for the allocation | 2640 | * Else we can use all the padding etc for the allocation |
2643 | */ | 2641 | */ |