Commit ff9b7e0b authored by Thorsten Blum's avatar Thorsten Blum Committed by Andrew Morton
Browse files

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: default avatarThorsten Blum <thorsten.blum@linux.dev>
Suggested-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
Reviewed-by: default avatarMarco 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: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 7882d8fc
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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. */
+2 −1
Original line number Diff line number Diff line
@@ -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,