From: Thorsten Blum Date: Wed, 15 Jan 2025 15:55:12 +0000 (+0100) Subject: mm/kfence: use str_write_read() helper in get_access_type() X-Git-Tag: v6.14-rc1~77^2~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ff9b7e0b17e67f8cf624c4fb7a536decfa6e2994;p=thirdparty%2Fkernel%2Flinux.git 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 Suggested-by: Anshuman Khandual Reviewed-by: Marco Elver Cc: Alexander Potapenko Cc: Anshuman Khandual Cc: Dmitriy Vyukov Cc: Thorsten Blum Signed-off-by: Andrew Morton --- diff --git a/mm/kfence/kfence_test.c b/mm/kfence/kfence_test.c index f65fb182466d5..00034e37bc9ff 100644 --- a/mm/kfence/kfence_test.c +++ b/mm/kfence/kfence_test.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -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. */ diff --git a/mm/kfence/report.c b/mm/kfence/report.c index 6370c5207d1a7..10e6802a2edff 100644 --- a/mm/kfence/report.c +++ b/mm/kfence/report.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -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,