Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Sep 2014 20:22:08 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 1200099 for review
Message-ID:  <201409102022.s8AKM8fN001134@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@1200099?ac=10

Change 1200099 by jhb@jhb_ralph on 2014/09/10 20:21:43

	Move this earlier and compare against uap->prot to avoid
	implicit truncation.

Affected files ...

.. //depot/projects/smpng/sys/vm/vm_mmap.c#107 edit

Differences ...

==== //depot/projects/smpng/sys/vm/vm_mmap.c#107 (text+ko) ====

@@ -211,6 +211,9 @@
 	struct vmspace *vms = td->td_proc->p_vmspace;
 	cap_rights_t rights;
 
+	if ((uap->prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_NONE)) != 0)
+		return (EINVAL);
+
 	addr = (vm_offset_t) uap->addr;
 	size = uap->len;
 	prot = uap->prot;
@@ -246,8 +249,6 @@
 	}
 	if ((flags & (MAP_EXCL | MAP_FIXED)) == MAP_EXCL)
 		return (EINVAL);
-	if ((prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_NONE)) != 0)
-		return (EINVAL);
 	if ((flags & (MAP_ANON | MAP_SHARED | MAP_PRIVATE)) == 0 ||
 	    (flags & (MAP_SHARED | MAP_PRIVATE)) == (MAP_SHARED | MAP_PRIVATE))
 		return (EINVAL);



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