Commit 5db06565 authored by Heiko Carstens's avatar Heiko Carstens Committed by Vasily Gorbik
Browse files

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: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent cca12b42
Loading
Loading
Loading
Loading
+9 −16
Original line number Diff line number Diff line
@@ -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);