Author: jhb
Date: Fri Jun 10 13:24:56 2011
New Revision: 222930
URL: http://svn.freebsd.org/changeset/base/222930

Log:
  Fix some off-by-one errors with the ending address of candidate regions
  when attempting to grow a window.

Modified:
  head/sys/dev/pci/pci_pci.c

Modified: head/sys/dev/pci/pci_pci.c
==============================================================================
--- head/sys/dev/pci/pci_pci.c  Fri Jun 10 12:30:16 2011        (r222929)
+++ head/sys/dev/pci/pci_pci.c  Fri Jun 10 13:24:56 2011        (r222930)
@@ -916,7 +916,8 @@ pcib_grow_window(struct pcib_softc *sc, 
 
                /* Move end_free down until it is properly aligned. */
                end_free &= ~(align - 1);
-               front = end_free - count;
+               end_free--;
+               front = end_free - (count - 1);
 
                /*
                 * The resource would now be allocated at (front,
@@ -944,7 +945,7 @@ pcib_grow_window(struct pcib_softc *sc, 
 
                /* Move start_free up until it is properly aligned. */
                start_free = roundup2(start_free, align);
-               back = start_free + count;
+               back = start_free + count - 1;
 
                /*
                 * The resource would now be allocated at (start_free,
@@ -957,7 +958,7 @@ pcib_grow_window(struct pcib_softc *sc, 
                        if (bootverbose)
                                printf("\tback candidate range: %#lx-%#lx\n",
                                    start_free, back);
-                       back = roundup2(back, w->step) - 1;
+                       back = roundup2(back + 1, w->step) - 1;
                        back -= rman_get_end(w->res);
                } else
                        back = 0;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to