From: Matthew Wilcox (Oracle) Date: Mon, 15 Sep 2025 13:55:08 +0000 (+0200) Subject: slab: Remove dead code in free_consistency_checks() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=f4930de03dcf4a3f2515546f5b3c04bac016685d;p=users%2Fhch%2Fmisc.git slab: Remove dead code in free_consistency_checks() We already know that slab is a valid slab as that's checked by the caller. In the future, we won't be able to get to a slab pointer from a non-slab page. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Harry Yoo Signed-off-by: Vlastimil Babka --- diff --git a/mm/slub.c b/mm/slub.c index 3062f56bf498..56143bfd1ae3 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1684,10 +1684,7 @@ static inline int free_consistency_checks(struct kmem_cache *s, return 0; if (unlikely(s != slab->slab_cache)) { - if (!folio_test_slab(slab_folio(slab))) { - slab_err(s, slab, "Attempt to free object(0x%p) outside of slab", - object); - } else if (!slab->slab_cache) { + if (!slab->slab_cache) { slab_err(NULL, slab, "No slab cache for object 0x%p", object); } else {