1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _LINUX_KASAN_ENABLED_H 3 #define _LINUX_KASAN_ENABLED_H 4 5 #include <linux/static_key.h> 6 7 #ifdef CONFIG_KASAN_HW_TAGS 8 9 DECLARE_STATIC_KEY_FALSE(kasan_flag_enabled); 10 kasan_enabled(void)11static __always_inline bool kasan_enabled(void) 12 { 13 return static_branch_likely(&kasan_flag_enabled); 14 } 15 kasan_hw_tags_enabled(void)16static inline bool kasan_hw_tags_enabled(void) 17 { 18 return kasan_enabled(); 19 } 20 21 #else /* CONFIG_KASAN_HW_TAGS */ 22 kasan_enabled(void)23static inline bool kasan_enabled(void) 24 { 25 return IS_ENABLED(CONFIG_KASAN); 26 } 27 kasan_hw_tags_enabled(void)28static inline bool kasan_hw_tags_enabled(void) 29 { 30 return false; 31 } 32 33 #endif /* CONFIG_KASAN_HW_TAGS */ 34 35 #endif /* LINUX_KASAN_ENABLED_H */ 36