projects/linux·commit 5dcf3308

powerpc/align: use get_user_instr() for a user-mode instruction

5dcf3308 · Linus Torvalds <[email protected]> · 2026-10-20 10:05:40 -10:00

fix_alignment() already reads the instruction with
copy_inst_from_kernel_nofault() when the PC is a kernel address, and
only uses __get_user_instr() when it is not.  That pointer is an
ordinary user address, so read it with get_user_instr().  On powerpc
__get_user() already does might_fault() and opens user access for the
read itself, so the only difference is the address check.

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

Signed-off-by: Linus Torvalds <[email protected]>
Commit
5dcf33085cd095010eecf42d04c9101821361d8d
Parents
52907f0e

Changes

1 files changed · +1 −1

FileStatusAddDelContent
arch/powerpc/kernel/align.cmodified+1−1View file

arch/powerpc/kernel/align.c

View file
diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c
index 6140943..c66642c 100644
--- a/arch/powerpc/kernel/align.c
+++ b/arch/powerpc/kernel/align.c
@@ -298,7 +298,7 @@ int fix_alignment(struct pt_regs *regs)
if (is_kernel_addr(regs->nip))
r = copy_inst_from_kernel_nofault(&instr, (void *)regs->nip);
else
- r = __get_user_instr(instr, (void __user *)regs->nip);
+ r = get_user_instr(instr, (void __user *)regs->nip);
if (unlikely(r))
return -EFAULT;