Commit a745b067 authored by Vlastimil Babka's avatar Vlastimil Babka

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: default avatarKees Cook <keescook@chromium.org>
Reviewed-by: default avatarMarco Elver <elver@google.com>
Acked-by: default avatarDavid Rientjes <rientjes@google.com>
Tested-by: default avatarDavid Rientjes <rientjes@google.com>
Reviewed-by: default avatarHyeonggon Yoo <42.hyeyoo@gmail.com>
Tested-by: default avatarHyeonggon Yoo <42.hyeyoo@gmail.com>
Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
parent 72786c0a
...@@ -463,11 +463,7 @@ static void *kfence_guarded_alloc(struct kmem_cache *cache, size_t size, gfp_t g ...@@ -463,11 +463,7 @@ static void *kfence_guarded_alloc(struct kmem_cache *cache, size_t size, gfp_t g
/* Set required slab fields. */ /* Set required slab fields. */
slab = virt_to_slab((void *)meta->addr); slab = virt_to_slab((void *)meta->addr);
slab->slab_cache = cache; slab->slab_cache = cache;
#if defined(CONFIG_SLUB)
slab->objects = 1; slab->objects = 1;
#elif defined(CONFIG_SLAB)
slab->s_mem = addr;
#endif
/* Memory initialization. */ /* Memory initialization. */
set_canary(meta); set_canary(meta);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment