Skip to content

Commit 63af526

Browse files
antonblanchardmpe
authored andcommitted
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>
1 parent e35735b commit 63af526

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

‎arch/powerpc/mm/fault.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,16 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address)
120120

121121
up_read(&current->mm->mmap_sem);
122122

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;
133133
}
134134

135135
static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)

0 commit comments

Comments
 (0)