openrisc: use get_kernel_nofault() in show_registers()

show_registers() dumps the stack and the code around the PC, but only
for a kernel-mode fault, and only after checking that each address is
at or above PAGE_OFFSET.  Both are kernel addresses that may not be
mapped.

It reads them with __get_user(), which predates get_kernel_nofault(),
the interface for exactly this: a kernel address that may not be mapped,
read with page faults disabled.

This is part of getting rid of __get_user() and __put_user() entirely.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds 2026-10-20 09:29:11 -10:00
parent 8eb93b8a67
commit 5a36c24b0e

View File

@ -124,7 +124,7 @@ void show_registers(struct pt_regs *regs)
for (i = -8; i < 24; i += 1) {
unsigned long word;
if (__get_user(word, &((unsigned long *)esp)[i])) {
if (get_kernel_nofault(word, &((unsigned long *)esp)[i])) {
bad_stack:
pr_info(" Bad Stack value.");
break;
@ -140,7 +140,7 @@ void show_registers(struct pt_regs *regs)
for (i = -6; i < 6; i += 1) {
unsigned long word;
if (__get_user(word, &((unsigned long *)regs->pc)[i])) {
if (get_kernel_nofault(word, &((unsigned long *)regs->pc)[i])) {
bad:
pr_info(" Bad PC value.");
break;