mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 22:21:21 +00:00
mm/kasan: change kasan_check_{read,write} to return boolean
This changes {,__}kasan_check_{read,write} functions to return a boolean denoting if the access was valid or not. [sfr@canb.auug.org.au: include types.h for "bool"] Link: http://lkml.kernel.org/r/20190705184949.13cdd021@canb.auug.org.au Link: http://lkml.kernel.org/r/20190626142014.141844-3-elver@google.com Signed-off-by: Marco Elver <elver@google.com> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Reviewed-by: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Alexander Potapenko <glider@google.com> Cc: Andrey Konovalov <andreyknvl@google.com> Cc: Christoph Lameter <cl@linux.com> Cc: Pekka Enberg <penberg@kernel.org> Cc: David Rientjes <rientjes@google.com> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Kees Cook <keescook@chromium.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
7d8ad890da
commit
b5f6e0fc7d
5 changed files with 47 additions and 26 deletions
|
@ -2,19 +2,25 @@
|
|||
#ifndef _LINUX_KASAN_CHECKS_H
|
||||
#define _LINUX_KASAN_CHECKS_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/*
|
||||
* __kasan_check_*: Always available when KASAN is enabled. This may be used
|
||||
* even in compilation units that selectively disable KASAN, but must use KASAN
|
||||
* to validate access to an address. Never use these in header files!
|
||||
*/
|
||||
#ifdef CONFIG_KASAN
|
||||
void __kasan_check_read(const volatile void *p, unsigned int size);
|
||||
void __kasan_check_write(const volatile void *p, unsigned int size);
|
||||
bool __kasan_check_read(const volatile void *p, unsigned int size);
|
||||
bool __kasan_check_write(const volatile void *p, unsigned int size);
|
||||
#else
|
||||
static inline void __kasan_check_read(const volatile void *p, unsigned int size)
|
||||
{ }
|
||||
static inline void __kasan_check_write(const volatile void *p, unsigned int size)
|
||||
{ }
|
||||
static inline bool __kasan_check_read(const volatile void *p, unsigned int size)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
static inline bool __kasan_check_write(const volatile void *p, unsigned int size)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -25,10 +31,14 @@ static inline void __kasan_check_write(const volatile void *p, unsigned int size
|
|||
#define kasan_check_read __kasan_check_read
|
||||
#define kasan_check_write __kasan_check_write
|
||||
#else
|
||||
static inline void kasan_check_read(const volatile void *p, unsigned int size)
|
||||
{ }
|
||||
static inline void kasan_check_write(const volatile void *p, unsigned int size)
|
||||
{ }
|
||||
static inline bool kasan_check_read(const volatile void *p, unsigned int size)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
static inline bool kasan_check_write(const volatile void *p, unsigned int size)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue