mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
UPSTREAM: 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.com
Signed-off-by: Andrey 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Bug: 254721825
(cherry picked from commit b3bb1d700e)
Change-Id: I6517d25a0afc2e0865cc6b4396c251b5b548f3b1
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
This commit is contained in:
committed by
Todd Kjos
parent
bf0146f013
commit
01fc7d35f8
@@ -444,15 +444,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,
|
||||
unsigned long ip)
|
||||
{
|
||||
unsigned long flags = user_access_save();
|
||||
bool ret = false;
|
||||
unsigned long ua_flags = user_access_save();
|
||||
bool ret = true;
|
||||
|
||||
if (likely(report_enabled())) {
|
||||
__kasan_report((void *)addr, size, is_write, ip);
|
||||
ret = true;
|
||||
if (unlikely(!report_enabled())) {
|
||||
ret = false;
|
||||
goto out;
|
||||
}
|
||||
|
||||
user_access_restore(flags);
|
||||
__kasan_report((void *)addr, size, is_write, ip);
|
||||
|
||||
out:
|
||||
user_access_restore(ua_flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user