Fix a couple of off-by-one bugs we recently introduced -- PFNs are one of the only indexes which are actually 0-based, so you really want to loop from 0 to the last page, inclusive (unlike most loops where you would stop *before* the last element index).

svn path=/trunk/; revision=32362
This commit is contained in:
ReactOS Portable Systems Group 2008-02-14 20:20:44 +00:00
parent ee3729d613
commit 99b1ac6cb9

View 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;