Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Dec 2011 06:55:27 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r228254 - stable/8/sys/amd64/amd64
Message-ID:  <201112040655.pB46tRZL074930@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Sun Dec  4 06:55:27 2011
New Revision: 228254
URL: http://svn.freebsd.org/changeset/base/228254

Log:
  MFC r214563,214576
    Add safety belts to pmap_demote_DMAP().

Modified:
  stable/8/sys/amd64/amd64/pmap.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/amd64/amd64/pmap.c
==============================================================================
--- stable/8/sys/amd64/amd64/pmap.c	Sun Dec  4 06:09:02 2011	(r228253)
+++ stable/8/sys/amd64/amd64/pmap.c	Sun Dec  4 06:55:27 2011	(r228254)
@@ -4841,7 +4841,12 @@ pmap_demote_DMAP(vm_paddr_t base, vm_siz
 	vm_offset_t va;
 	boolean_t changed;
 
-	if (len < NBPDP) {
+	if (len == 0)
+		return;
+	KASSERT(powerof2(len), ("pmap_demote_DMAP: len is not a power of 2"));
+	KASSERT((base & (len - 1)) == 0,
+	    ("pmap_demote_DMAP: base is not a multiple of len"));
+	if (len < NBPDP && base < dmaplimit) {
 		va = PHYS_TO_DMAP(base);
 		changed = FALSE;
 		PMAP_LOCK(kernel_pmap);



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