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]
This commit is contained in:
parent
7a11d7d883
commit
cea42d1179
@ -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 @@ trap_pfault(frame, usermode)
|
||||
trap_fatal(frame, eva);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
return((rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV);
|
||||
return ((rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user