1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_KASAN_ENABLED_H
3 #define _LINUX_KASAN_ENABLED_H
5 #include <linux/static_key.h>
7 #ifdef CONFIG_KASAN_HW_TAGS
9 DECLARE_STATIC_KEY_FALSE(kasan_flag_enabled
);
11 static __always_inline
bool kasan_enabled(void)
13 return static_branch_likely(&kasan_flag_enabled
);
16 static inline bool kasan_hw_tags_enabled(void)
18 return kasan_enabled();
21 #else /* CONFIG_KASAN_HW_TAGS */
23 static inline bool kasan_enabled(void)
25 return IS_ENABLED(CONFIG_KASAN
);
28 static inline bool kasan_hw_tags_enabled(void)
33 #endif /* CONFIG_KASAN_HW_TAGS */
35 #endif /* LINUX_KASAN_ENABLED_H */