Skip to content

Commit

Permalink
kasan: merge __kasan_report into kasan_report
Browse files Browse the repository at this point in the history
Merge __kasan_report() into kasan_report().  The code is simple enough to
be readable without the __kasan_report() helper.

Link: https://lkml.kernel.org/r/c8a125497ef82f7042b3795918dffb81a85a878e.1646237226.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <[email protected]>
Cc: Alexander Potapenko <[email protected]>
Cc: Andrey Ryabinin <[email protected]>
Cc: Dmitry Vyukov <[email protected]>
Cc: Marco Elver <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
xairy authored and torvalds committed Mar 25, 2022
1 parent b3bb1d7 commit be8631a
Showing 1 changed file with 15 additions and 21 deletions.
36 changes: 15 additions & 21 deletions mm/kasan/report.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,37 +435,31 @@ static void print_report(struct kasan_access_info *info)
}
}

static void __kasan_report(void *addr, size_t size, bool is_write,
unsigned long ip)
{
struct kasan_access_info info;
unsigned long flags;

start_report(&flags, true);

info.access_addr = addr;
info.first_bad_addr = kasan_find_first_bad_addr(addr, size);
info.access_size = size;
info.is_write = is_write;
info.ip = ip;

print_report(&info);

end_report(&flags, addr);
}

bool kasan_report(unsigned long addr, size_t size, bool is_write,
unsigned long ip)
{
unsigned long ua_flags = user_access_save();
bool ret = true;
void *ptr = (void *)addr;
unsigned long ua_flags = user_access_save();
unsigned long irq_flags;
struct kasan_access_info info;

if (unlikely(!report_enabled())) {
ret = false;
goto out;
}

__kasan_report((void *)addr, size, is_write, ip);
start_report(&irq_flags, true);

info.access_addr = ptr;
info.first_bad_addr = kasan_find_first_bad_addr(ptr, size);
info.access_size = size;
info.is_write = is_write;
info.ip = ip;

print_report(&info);

end_report(&irq_flags, ptr);

out:
user_access_restore(ua_flags);
Expand Down

0 comments on commit be8631a

Please sign in to comment.