Skip to content

Commit ff27a9a

Browse files
tobluxmaddy-kerneldev
authored andcommitted
powerpc/mm/fault: Use str_write_read() helper function
Remove hard-coded strings by using the str_write_read() helper function. Signed-off-by: Thorsten Blum <[email protected]> Reviewed-by: Christophe Leroy <[email protected]> Signed-off-by: Madhavan Srinivasan <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 7e99a4a commit ff27a9a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arch/powerpc/mm/fault.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/kernel.h>
1818
#include <linux/errno.h>
1919
#include <linux/string.h>
20+
#include <linux/string_choices.h>
2021
#include <linux/types.h>
2122
#include <linux/pagemap.h>
2223
#include <linux/ptrace.h>
@@ -218,7 +219,7 @@ static bool bad_kernel_fault(struct pt_regs *regs, unsigned long error_code,
218219
// Read/write fault blocked by KUAP is bad, it can never succeed.
219220
if (bad_kuap_fault(regs, address, is_write)) {
220221
pr_crit_ratelimited("Kernel attempted to %s user page (%lx) - exploit attempt? (uid: %d)\n",
221-
is_write ? "write" : "read", address,
222+
str_write_read(is_write), address,
222223
from_kuid(&init_user_ns, current_uid()));
223224

224225
// Fault on user outside of certain regions (eg. copy_tofrom_user()) is bad
@@ -625,7 +626,7 @@ static void __bad_page_fault(struct pt_regs *regs, int sig)
625626
case INTERRUPT_DATA_STORAGE:
626627
case INTERRUPT_H_DATA_STORAGE:
627628
pr_alert("BUG: %s on %s at 0x%08lx\n", msg,
628-
is_write ? "write" : "read", regs->dar);
629+
str_write_read(is_write), regs->dar);
629630
break;
630631
case INTERRUPT_DATA_SEGMENT:
631632
pr_alert("BUG: %s at 0x%08lx\n", msg, regs->dar);

0 commit comments

Comments
 (0)