Date: Mon, 12 Mar 2012 00:47:14 +0000 (UTC) From: Alan Cox <alc@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r232842 - head/sys/amd64/amd64 Message-ID: <201203120047.q2C0lEHm034251@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: alc Date: Mon Mar 12 00:47:13 2012 New Revision: 232842 URL: http://svn.freebsd.org/changeset/base/232842 Log: 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] Modified: head/sys/amd64/amd64/trap.c Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Sun Mar 11 22:30:06 2012 (r232841) +++ head/sys/amd64/amd64/trap.c Mon Mar 12 00:47:13 2012 (r232842) @@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203120047.q2C0lEHm034251>