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 <keescook@chromium.org> Reviewed-by: Marco Elver <elver@google.com> Acked-by: David Rientjes <rientjes@google.com> Tested-by: David Rientjes <rientjes@google.com> Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
This commit is contained in:
parent
72786c0a3d
commit
a745b067db
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue