Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/lib: Don't use __put_user_asm_goto() outside of uaccess.h

__put_user_asm_goto() is internal to uaccess.h

Use __put_kernel_nofault() instead. The generated code is identical.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/3e32c4f0361933909368b68f5ee569e5de661c1b.1615398498.git.christophe.leroy@csgroup.eu

authored by

Christophe Leroy and committed by
Michael Ellerman
e63ceebd fd69d544

+9 -4
+9 -4
arch/powerpc/lib/code-patching.c
··· 21 21 static int __patch_instruction(struct ppc_inst *exec_addr, struct ppc_inst instr, 22 22 struct ppc_inst *patch_addr) 23 23 { 24 - if (!ppc_inst_prefixed(instr)) 25 - __put_user_asm_goto(ppc_inst_val(instr), patch_addr, failed, "stw"); 26 - else 27 - __put_user_asm_goto(ppc_inst_as_u64(instr), patch_addr, failed, "std"); 24 + if (!ppc_inst_prefixed(instr)) { 25 + u32 val = ppc_inst_val(instr); 26 + 27 + __put_kernel_nofault(patch_addr, &val, u32, failed); 28 + } else { 29 + u64 val = ppc_inst_as_u64(instr); 30 + 31 + __put_kernel_nofault(patch_addr, &val, u64, failed); 32 + } 28 33 29 34 asm ("dcbst 0, %0; sync; icbi 0,%1; sync; isync" :: "r" (patch_addr), 30 35 "r" (exec_addr));