Commit b3bb1d70 authored by Andrey Konovalov's avatar Andrey Konovalov Committed by Linus Torvalds

kasan: restructure kasan_report

Restructure kasan_report() to make reviewing the subsequent patches
easier.

Link: https://lkml.kernel.org/r/ca28042889858b8cc4724d3d4378387f90d7a59d.1646237226.git.andreyknvl@google.comSigned-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Marco Elver <elver@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b9132800
...@@ -457,15 +457,18 @@ static void __kasan_report(void *addr, size_t size, bool is_write, ...@@ -457,15 +457,18 @@ static void __kasan_report(void *addr, size_t size, bool is_write,
bool kasan_report(unsigned long addr, size_t size, bool is_write, bool kasan_report(unsigned long addr, size_t size, bool is_write,
unsigned long ip) unsigned long ip)
{ {
unsigned long flags = user_access_save(); unsigned long ua_flags = user_access_save();
bool ret = false; bool ret = true;
if (likely(report_enabled())) { if (unlikely(!report_enabled())) {
__kasan_report((void *)addr, size, is_write, ip); ret = false;
ret = true; goto out;
} }
user_access_restore(flags); __kasan_report((void *)addr, size, is_write, ip);
out:
user_access_restore(ua_flags);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment