Skip to content

Commit 5db0656

Browse files
hcahcaVasily Gorbik
authored andcommitted
s390/mm,fault: get rid of do_low_address()
There is only one caller of do_low_address(). Given that this code is quite special just get rid of do_low_address, and add it to do_protection_exception() in order to make the code a bit more readable. Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
1 parent cca12b4 commit 5db0656

1 file changed

Lines changed: 9 additions & 16 deletions

File tree

arch/s390/mm/fault.c

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -257,20 +257,6 @@ static void do_no_context(struct pt_regs *regs, vm_fault_t fault)
257257
die(regs, "Oops");
258258
}
259259

260-
static void do_low_address(struct pt_regs *regs)
261-
{
262-
/*
263-
* Low-address protection hit in kernel mode means
264-
* NULL pointer write access in kernel mode.
265-
*/
266-
if (regs->psw.mask & PSW_MASK_PSTATE) {
267-
/* Low-address protection hit in user mode: 'cannot happen' */
268-
die(regs, "Low-address protection");
269-
}
270-
271-
do_no_context(regs, VM_FAULT_BADACCESS);
272-
}
273-
274260
static void do_sigbus(struct pt_regs *regs)
275261
{
276262
force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)get_fault_address(regs));
@@ -504,8 +490,15 @@ void do_protection_exception(struct pt_regs *regs)
504490
* field is not guaranteed to contain valid data in this case.
505491
*/
506492
if (unlikely(!teid.b61)) {
507-
do_low_address(regs);
508-
return;
493+
if (user_mode(regs)) {
494+
/* Low-address protection in user mode: cannot happen */
495+
die(regs, "Low-address protection");
496+
}
497+
/*
498+
* Low-address protection in kernel mode means
499+
* NULL pointer write access in kernel mode.
500+
*/
501+
return do_no_context(regs, VM_FAULT_BADACCESS);
509502
}
510503
if (unlikely(MACHINE_HAS_NX && teid.b56)) {
511504
regs->int_parm_long = (teid.addr * PAGE_SIZE) | (regs->psw.addr & PAGE_MASK);

0 commit comments

Comments
 (0)