summaryrefslogtreecommitdiff
path: root/mm/kasan/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/kasan/common.c')
-rw-r--r--mm/kasan/common.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/mm/kasan/common.c b/mm/kasan/common.c
index 19ddc0ed0e7b..d0300954d76b 100644
--- a/mm/kasan/common.c
+++ b/mm/kasan/common.c
@@ -88,13 +88,10 @@ asmlinkage void kasan_unpoison_task_stack_below(const void *watermark)
}
#endif /* CONFIG_KASAN_STACK */
-/*
- * Only allow cache merging when stack collection is disabled and no metadata
- * is present.
- */
+/* Only allow cache merging when no per-object metadata is present. */
slab_flags_t __kasan_never_merge(void)
{
- if (kasan_stack_collection_enabled())
+ if (kasan_requires_meta())
return SLAB_KASAN;
return 0;
}
@@ -152,7 +149,7 @@ void __kasan_cache_create(struct kmem_cache *cache, unsigned int *size,
*/
*flags |= SLAB_KASAN;
- if (!kasan_stack_collection_enabled())
+ if (!kasan_requires_meta())
return;
ok_size = *size;
@@ -220,7 +217,7 @@ void __kasan_cache_create_kmalloc(struct kmem_cache *cache)
size_t __kasan_metadata_size(struct kmem_cache *cache)
{
- if (!kasan_stack_collection_enabled())
+ if (!kasan_requires_meta())
return 0;
return (cache->kasan_info.alloc_meta_offset ?
sizeof(struct kasan_alloc_meta) : 0) +
@@ -295,7 +292,7 @@ void * __must_check __kasan_init_slab_obj(struct kmem_cache *cache,
const void *object)
{
/* Initialize per-object metadata if it is present. */
- if (kasan_stack_collection_enabled())
+ if (kasan_requires_meta())
kasan_init_object_meta(cache, object);
/* Tag is ignored in set_tag() without CONFIG_KASAN_SW/HW_TAGS */