Fix a couple of off-by-one bugs we recently introduced -- PFNs are one of the only...
authorReactOS Portable Systems Group <ros-arm-bringup@svn.reactos.org>
Thu, 14 Feb 2008 20:20:44 +0000 (20:20 +0000)
committerReactOS Portable Systems Group <ros-arm-bringup@svn.reactos.org>
Thu, 14 Feb 2008 20:20:44 +0000 (20:20 +0000)
svn path=/trunk/; revision=32362

reactos/ntoskrnl/mm/freelist.c

index f725370..e347958 100644 (file)
@@ -354,7 +354,7 @@ MmInitializePageList(IN ULONG_PTR FirstPhysKernelAddress,
     KernelPageEnd = LastPhysKernelAddress / PAGE_SIZE;
     
     /* Loop every page on the system */
-    for (i = 0; i < MmPageArraySize; i++)
+    for (i = 0; i <= MmPageArraySize; i++)
     {                
         /* Check if it's part of RAM */
         if (MiIsPfnRam(BIOSMemoryMap, AddressRangeCount, i))
@@ -417,7 +417,7 @@ MmInitializePageList(IN ULONG_PTR FirstPhysKernelAddress,
                 MmPageArray[i].MapCount = 1;
                 MmStats.NrSystemPages++;
             }
-            else if (i > (MiFreeDescriptor->BasePage + MiFreeDescriptor->PageCount - 1))
+            else if (i >= (MiFreeDescriptor->BasePage + MiFreeDescriptor->PageCount))
             {
                 /* These are pages we allocated above to hold the PFN DB */
                 MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_USED;