Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_KASAN_ENABLED_H
0003 #define _LINUX_KASAN_ENABLED_H
0004 
0005 #include <linux/static_key.h>
0006 
0007 #ifdef CONFIG_KASAN_HW_TAGS
0008 
0009 DECLARE_STATIC_KEY_FALSE(kasan_flag_enabled);
0010 
0011 static __always_inline bool kasan_enabled(void)
0012 {
0013     return static_branch_likely(&kasan_flag_enabled);
0014 }
0015 
0016 static inline bool kasan_hw_tags_enabled(void)
0017 {
0018     return kasan_enabled();
0019 }
0020 
0021 #else /* CONFIG_KASAN_HW_TAGS */
0022 
0023 static inline bool kasan_enabled(void)
0024 {
0025     return IS_ENABLED(CONFIG_KASAN);
0026 }
0027 
0028 static inline bool kasan_hw_tags_enabled(void)
0029 {
0030     return false;
0031 }
0032 
0033 #endif /* CONFIG_KASAN_HW_TAGS */
0034 
0035 #endif /* LINUX_KASAN_ENABLED_H */