Skip to content

Commit

Permalink
KFENCE: cleanup kfence_guarded_alloc() after CONFIG_SLAB removal
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Marco Elver <[email protected]>
Acked-by: David Rientjes <[email protected]>
Tested-by: David Rientjes <[email protected]>
Reviewed-by: Hyeonggon Yoo <[email protected]>
Tested-by: Hyeonggon Yoo <[email protected]>
Signed-off-by: Vlastimil Babka <[email protected]>
  • Loading branch information
tehcaster committed Dec 5, 2023
1 parent 72786c0 commit a745b06
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions mm/kfence/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a745b06

Please sign in to comment.