diff options
author | Heiko Carstens <hca@linux.ibm.com> | 2023-10-12 10:40:46 +0300 |
---|---|---|
committer | Vasily Gorbik <gor@linux.ibm.com> | 2023-10-23 19:21:22 +0300 |
commit | 5db06565cad67442e4677e7c0da7f7dad1eccb03 (patch) | |
tree | a53fe8b1ca841460724fc1bd9be570d040995e9a /arch/s390 | |
parent | cca12b427d43bb57be207d634e1d44e9792d1cb4 (diff) | |
download | linux-5db06565cad67442e4677e7c0da7f7dad1eccb03.tar.xz |
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>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/mm/fault.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index ee8a40917592..87bfcf4d3082 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c @@ -257,20 +257,6 @@ static void do_no_context(struct pt_regs *regs, vm_fault_t fault) die(regs, "Oops"); } -static void do_low_address(struct pt_regs *regs) -{ - /* - * Low-address protection hit in kernel mode means - * NULL pointer write access in kernel mode. - */ - if (regs->psw.mask & PSW_MASK_PSTATE) { - /* Low-address protection hit in user mode: 'cannot happen' */ - die(regs, "Low-address protection"); - } - - do_no_context(regs, VM_FAULT_BADACCESS); -} - static void do_sigbus(struct pt_regs *regs) { force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)get_fault_address(regs)); @@ -504,8 +490,15 @@ void do_protection_exception(struct pt_regs *regs) * field is not guaranteed to contain valid data in this case. */ if (unlikely(!teid.b61)) { - do_low_address(regs); - return; + if (user_mode(regs)) { + /* Low-address protection in user mode: cannot happen */ + die(regs, "Low-address protection"); + } + /* + * Low-address protection in kernel mode means + * NULL pointer write access in kernel mode. + */ + return do_no_context(regs, VM_FAULT_BADACCESS); } if (unlikely(MACHINE_HAS_NX && teid.b56)) { regs->int_parm_long = (teid.addr * PAGE_SIZE) | (regs->psw.addr & PAGE_MASK); |