Commit 5e55452f authored by Andrey Konovalov's avatar Andrey Konovalov Committed by Stephen Rothwell
Browse files

kasan: open-code kasan_unpoison_slab

There's the external annotation kasan_unpoison_slab() that is currently
defined as static inline and uses kasan_unpoison_range(). Open-code this
function in mempool.c. Otherwise with an upcoming change this function
will result in an unnecessary function call.


Signed-off-by: default avatarAndrey Konovalov <>
Reviewed-by: default avatarMarco Elver <>
Tested-by: Vincenzo Frascino's avatarVincenzo Frascino <>
Cc: Alexander Potapenko <>
Cc: Andrey Ryabinin <>
Cc: Branislav Rankov <>
Cc: Catalin Marinas <>
Cc: Dmitry Vyukov <>
Cc: Evgenii Stepanov <>
Cc: Kevin Brodsky <>
Cc: Vasily Gorbik <>
Cc: Will Deacon <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarStephen Rothwell <>
parent afb1d9f7
......@@ -106,11 +106,6 @@ struct kasan_cache {
int free_meta_offset;
size_t __ksize(const void *);
static inline void kasan_unpoison_slab(const void *ptr)
kasan_unpoison_range(ptr, __ksize(ptr));
size_t kasan_metadata_size(struct kmem_cache *cache);
bool kasan_save_enable_multi_shot(void);
......@@ -166,7 +161,6 @@ static inline bool kasan_slab_free(struct kmem_cache *s, void *object,
return false;
static inline void kasan_unpoison_slab(const void *ptr) { }
static inline size_t kasan_metadata_size(struct kmem_cache *cache) { return 0; }
#endif /* CONFIG_KASAN */
......@@ -112,7 +112,7 @@ static __always_inline void kasan_poison_element(mempool_t *pool, void *element)
static void kasan_unpoison_element(mempool_t *pool, void *element)
if (pool->alloc == mempool_alloc_slab || pool->alloc == mempool_kmalloc)
kasan_unpoison_range(element, __ksize(element));
else if (pool->alloc == mempool_alloc_pages)
kasan_alloc_pages(element, (unsigned long)pool->pool_data);
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