diff options
author | Vlastimil Babka <vbabka@suse.cz> | 2023-07-11 15:35:33 +0200 |
---|---|---|
committer | Vlastimil Babka <vbabka@suse.cz> | 2023-07-14 09:57:21 +0200 |
commit | 1662b6c2bb7e7502d6ae4b6aca4116e844a4277c (patch) | |
tree | 0836c07cc5a21dd504612e1d50cd413de0dc15e9 | |
parent | b06952cdbc7f01a761eb95e8b899633f4ae9334e (diff) |
mm/slub: remove freelist_dereference()
freelist_dereference() is a one-liner only used from get_freepointer().
Remove it and make get_freepointer() call freelist_ptr_decode()
directly to make the code easier to follow.
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Kees Cook <keescook@chromium.org>
-rw-r--r-- | mm/slub.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/mm/slub.c b/mm/slub.c index 07edad305512..f7940048138c 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -397,18 +397,15 @@ static inline void *freelist_ptr_decode(const struct kmem_cache *s, return decoded; } -/* Returns the freelist pointer recorded at location ptr_addr. */ -static inline void *freelist_dereference(const struct kmem_cache *s, - void *ptr_addr) -{ - return freelist_ptr_decode(s, *(freeptr_t *)(ptr_addr), - (unsigned long)ptr_addr); -} - static inline void *get_freepointer(struct kmem_cache *s, void *object) { + unsigned long ptr_addr; + freeptr_t p; + object = kasan_reset_tag(object); - return freelist_dereference(s, (freeptr_t *)(object + s->offset)); + ptr_addr = (unsigned long)object + s->offset; + p = *(freeptr_t *)(ptr_addr); + return freelist_ptr_decode(s, p, ptr_addr); } #ifndef CONFIG_SLUB_TINY |