@@ -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,
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;
}