1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_KASAN_CHECKS_H
3 #define _LINUX_KASAN_CHECKS_H
5 #include <linux/types.h>
8 * The annotations present in this file are only relevant for the software
9 * KASAN modes that rely on compiler instrumentation, and will be optimized
10 * away for the hardware tag-based KASAN mode. Use kasan_check_byte() instead.
14 * __kasan_check_*: Always available when KASAN is enabled. This may be used
15 * even in compilation units that selectively disable KASAN, but must use KASAN
16 * to validate access to an address. Never use these in header files!
18 #if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
19 bool __kasan_check_read(const volatile void *p, unsigned int size);
20 bool __kasan_check_write(const volatile void *p, unsigned int size);
22 static inline bool __kasan_check_read(const volatile void *p, unsigned int size)
26 static inline bool __kasan_check_write(const volatile void *p, unsigned int size)
33 * kasan_check_*: Only available when the particular compilation unit has KASAN
34 * instrumentation enabled. May be used in header files.
36 #ifdef __SANITIZE_ADDRESS__
37 #define kasan_check_read __kasan_check_read
38 #define kasan_check_write __kasan_check_write
40 static inline bool kasan_check_read(const volatile void *p, unsigned int size)
44 static inline bool kasan_check_write(const volatile void *p, unsigned int size)