From: Vlastimil Babka Date: Mon, 2 Oct 2023 14:28:44 +0000 (+0200) Subject: KFENCE: cleanup kfence_guarded_alloc() after CONFIG_SLAB removal X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a745b067db0f0711974063deb78c6639c24ec5bf;p=linux.git KFENCE: cleanup kfence_guarded_alloc() after CONFIG_SLAB removal Some struct slab fields are initialized differently for SLAB and SLUB so we can simplify with SLUB being the only remaining allocator. Reviewed-by: Kees Cook Reviewed-by: Marco Elver Acked-by: David Rientjes Tested-by: David Rientjes Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Vlastimil Babka --- diff --git a/mm/kfence/core.c b/mm/kfence/core.c index 3872528d09638..8350f5c06f2e0 100644 --- a/mm/kfence/core.c +++ b/mm/kfence/core.c @@ -463,11 +463,7 @@ static void *kfence_guarded_alloc(struct kmem_cache *cache, size_t size, gfp_t g /* Set required slab fields. */ slab = virt_to_slab((void *)meta->addr); slab->slab_cache = cache; -#if defined(CONFIG_SLUB) slab->objects = 1; -#elif defined(CONFIG_SLAB) - slab->s_mem = addr; -#endif /* Memory initialization. */ set_canary(meta);