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

powerpc: Simplify do_sigbus

Exit out early for a kernel fault, avoiding indenting of
most of the function.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Anton Blanchard and committed by
Michael Ellerman
63af5262 e35735b9

+10 -10
+10 -10
arch/powerpc/mm/fault.c
··· 120 120 121 121 up_read(&current->mm->mmap_sem); 122 122 123 - if (user_mode(regs)) { 124 - current->thread.trap_nr = BUS_ADRERR; 125 - info.si_signo = SIGBUS; 126 - info.si_errno = 0; 127 - info.si_code = BUS_ADRERR; 128 - info.si_addr = (void __user *)address; 129 - force_sig_info(SIGBUS, &info, current); 130 - return MM_FAULT_RETURN; 131 - } 132 - return MM_FAULT_ERR(SIGBUS); 123 + if (!user_mode(regs)) 124 + return MM_FAULT_ERR(SIGBUS); 125 + 126 + current->thread.trap_nr = BUS_ADRERR; 127 + info.si_signo = SIGBUS; 128 + info.si_errno = 0; 129 + info.si_code = BUS_ADRERR; 130 + info.si_addr = (void __user *)address; 131 + force_sig_info(SIGBUS, &info, current); 132 + return MM_FAULT_RETURN; 133 133 } 134 134 135 135 static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)