powerpc: use probe_user_read() and probe_user_write()

Instead of opencoding, use probe_user_read() to failessly read
a user location and probe_user_write() for writing to user.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/e041f5eedb23f09ab553be8a91c3de2087147320.1579800517.git.christophe.leroy@c-s.fr
This commit is contained in:
Christophe Leroy
2020-01-23 17:30:47 +00:00
committed by Michael Ellerman
parent 1e3531982e
commit def0bfdbd6
7 changed files with 14 additions and 62 deletions

View File

@@ -1065,13 +1065,11 @@ int fsl_pci_mcheck_exception(struct pt_regs *regs)
addr += mfspr(SPRN_MCAR);
if (is_in_pci_mem_space(addr)) {
if (user_mode(regs)) {
pagefault_disable();
ret = get_user(inst, (__u32 __user *)regs->nip);
pagefault_enable();
} else {
if (user_mode(regs))
ret = probe_user_read(&inst, (void __user *)regs->nip,
sizeof(inst));
else
ret = probe_kernel_address((void *)regs->nip, inst);
}
if (!ret && mcheck_handle_load(regs, inst)) {
regs->nip += 4;