mirror of
https://github.com/torvalds/linux.git
synced 2025-04-12 06:49:52 +00:00
mm/kfence: use str_write_read() helper in get_access_type()
Remove hard-coded strings by using the str_write_read() helper function. Link: https://lkml.kernel.org/r/20250115155511.954535-2-thorsten.blum@linux.dev Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Suggested-by: Anshuman Khandual <anshuman.khandual@arm.com> Reviewed-by: Marco Elver <elver@google.com> Cc: Alexander Potapenko <glider@google.com> Cc: Anshuman Khandual <anshuman.khandual@arm.com> Cc: Dmitriy Vyukov <dvyukov@google.com> Cc: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
7882d8fc8f
commit
ff9b7e0b17
@ -20,6 +20,7 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/string_choices.h>
|
||||
#include <linux/tracepoint.h>
|
||||
#include <trace/events/printk.h>
|
||||
|
||||
@ -88,7 +89,7 @@ struct expect_report {
|
||||
|
||||
static const char *get_access_type(const struct expect_report *r)
|
||||
{
|
||||
return r->is_write ? "write" : "read";
|
||||
return str_write_read(r->is_write);
|
||||
}
|
||||
|
||||
/* Check observed report matches information in @r. */
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <linux/sprintf.h>
|
||||
#include <linux/stacktrace.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/string_choices.h>
|
||||
#include <linux/sched/clock.h>
|
||||
#include <trace/events/error_report.h>
|
||||
|
||||
@ -184,7 +185,7 @@ static void print_diff_canary(unsigned long address, size_t bytes_to_show,
|
||||
|
||||
static const char *get_access_type(bool is_write)
|
||||
{
|
||||
return is_write ? "write" : "read";
|
||||
return str_write_read(is_write);
|
||||
}
|
||||
|
||||
void kfence_report_error(unsigned long address, bool is_write, struct pt_regs *regs,
|
||||
|
Loading…
x
Reference in New Issue
Block a user