Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Jul 2019 19:01:15 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r349608 - head/sys/vm
Message-ID:  <201907021901.x62J1FbK087997@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Jul  2 19:01:14 2019
New Revision: 349608
URL: https://svnweb.freebsd.org/changeset/base/349608

Log:
  Use traditional 'p' local to designate td->td_proc in kern_mmap.
  
  Reviewed by:	emaste, markj
  Sponsored by:	The FreeBSD Foundation
  MFC after:	3 days
  Differential revision:	https://reviews.freebsd.org/D20795

Modified:
  head/sys/vm/vm_mmap.c

Modified: head/sys/vm/vm_mmap.c
==============================================================================
--- head/sys/vm/vm_mmap.c	Tue Jul  2 17:48:27 2019	(r349607)
+++ head/sys/vm/vm_mmap.c	Tue Jul  2 19:01:14 2019	(r349608)
@@ -187,6 +187,7 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t l
 {
 	struct vmspace *vms;
 	struct file *fp;
+	struct proc *p;
 	vm_offset_t addr;
 	vm_size_t pageoff, size;
 	vm_prot_t cap_maxprot;
@@ -199,6 +200,9 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t l
 	prot = PROT_EXTRACT(prot);
 	if (max_prot != 0 && (max_prot & prot) != prot)
 		return (EINVAL);
+
+	p = td->td_proc;
+
 	/*
 	 * Always honor PROT_MAX if set.  If not, default to all
 	 * permissions unless we're implying maximum permissions.
@@ -209,7 +213,7 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t l
 		max_prot = (imply_prot_max && prot != PROT_NONE) ?
 		    prot : _PROT_ALL;
 
-	vms = td->td_proc->p_vmspace;
+	vms = p->p_vmspace;
 	fp = NULL;
 	AUDIT_ARG_FD(fd);
 	addr = addr0;
@@ -229,7 +233,7 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t l
 	 * pos.
 	 */
 	if (!SV_CURPROC_FLAG(SV_AOUT)) {
-		if ((len == 0 && curproc->p_osrel >= P_OSREL_MAP_ANON) ||
+		if ((len == 0 && p->p_osrel >= P_OSREL_MAP_ANON) ||
 		    ((flags & MAP_ANON) != 0 && (fd != -1 || pos != 0)))
 			return (EINVAL);
 	} else {
@@ -375,7 +379,7 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t l
 		if (error != 0)
 			goto done;
 		if ((flags & (MAP_SHARED | MAP_PRIVATE)) == 0 &&
-		    td->td_proc->p_osrel >= P_OSREL_MAP_FSTRICT) {
+		    p->p_osrel >= P_OSREL_MAP_FSTRICT) {
 			error = EINVAL;
 			goto done;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907021901.x62J1FbK087997>