summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2012-03-12 00:47:13 +0000
committeralc <alc@FreeBSD.org>2012-03-12 00:47:13 +0000
commit0500a4c033906a8e9da0458ed7bc3a4da41bbfff (patch)
tree7645fb27cb98bd48b6110c0649d410795bd1c8a0 /sys/amd64
parentd85719f11c1a0dc73d68f8ac0beef2bb600eadfe (diff)
downloadFreeBSD-src-0500a4c033906a8e9da0458ed7bc3a4da41bbfff.zip
FreeBSD-src-0500a4c033906a8e9da0458ed7bc3a4da41bbfff.tar.gz
Simplify the error checking in one branch of trap_pfault() and update
the nearby comment. Add missing whitespace to a return statement in trap_pfault(). Submitted by: kib [2]
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/trap.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index a2363db..28bf79d 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
@@ -645,7 +645,7 @@ trap_pfault(frame, usermode)
int usermode;
{
vm_offset_t va;
- struct vmspace *vm = NULL;
+ struct vmspace *vm;
vm_map_t map;
int rv = 0;
vm_prot_t ftype;
@@ -664,14 +664,10 @@ trap_pfault(frame, usermode)
map = kernel_map;
} else {
/*
- * This is a fault on non-kernel virtual memory.
- * vm is initialized above to NULL. If curproc is NULL
- * or curproc->p_vmspace is NULL the fault is fatal.
+ * This is a fault on non-kernel virtual memory. If either
+ * p or p->p_vmspace is NULL, then the fault is fatal.
*/
- if (p != NULL)
- vm = p->p_vmspace;
-
- if (vm == NULL)
+ if (p == NULL || (vm = p->p_vmspace) == NULL)
goto nogo;
map = &vm->vm_map;
@@ -735,8 +731,7 @@ nogo:
trap_fatal(frame, eva);
return (-1);
}
-
- return((rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV);
+ return ((rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV);
}
static void
OpenPOWER on IntegriCloud