Author: kib
Date: Sun Jun 12 02:42:08 2016
New Revision: 301835
URL: https://svnweb.freebsd.org/changeset/base/301835

Log:
  MFC r301457:
  Avoid spurious EINVAL in amd64 pmap_change_attr().

Modified:
  stable/10/sys/amd64/amd64/pmap.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/amd64/pmap.c
==============================================================================
--- stable/10/sys/amd64/amd64/pmap.c    Sat Jun 11 14:46:49 2016        
(r301834)
+++ stable/10/sys/amd64/amd64/pmap.c    Sun Jun 12 02:42:08 2016        
(r301835)
@@ -6480,7 +6480,7 @@ static int
 pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode)
 {
        vm_offset_t base, offset, tmpva;
-       vm_paddr_t pa_start, pa_end;
+       vm_paddr_t pa_start, pa_end, pa_end1;
        pdp_entry_t *pdpe;
        pd_entry_t *pde;
        pt_entry_t *pte;
@@ -6660,9 +6660,12 @@ pmap_change_attr_locked(vm_offset_t va, 
                        tmpva += PAGE_SIZE;
                }
        }
-       if (error == 0 && pa_start != pa_end)
-               error = pmap_change_attr_locked(PHYS_TO_DMAP(pa_start),
-                   pa_end - pa_start, mode);
+       if (error == 0 && pa_start != pa_end && pa_start < dmaplimit) {
+               pa_end1 = MIN(pa_end, dmaplimit);
+               if (pa_start != pa_end1)
+                       error = pmap_change_attr_locked(PHYS_TO_DMAP(pa_start),
+                           pa_end1 - pa_start, mode);
+       }
 
        /*
         * Flush CPU caches if required to make sure any data isn't cached that
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to