Author: ros-arm-bringup Date: Thu Feb 14 23:20:44 2008 New Revision: 32362
URL: http://svn.reactos.org/svn/reactos?rev=32362&view=rev Log: 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).
Modified: trunk/reactos/ntoskrnl/mm/freelist.c
Modified: trunk/reactos/ntoskrnl/mm/freelist.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/freelist.c?rev=... ============================================================================== --- trunk/reactos/ntoskrnl/mm/freelist.c (original) +++ trunk/reactos/ntoskrnl/mm/freelist.c Thu Feb 14 23:20:44 2008 @@ -354,7 +354,7 @@ 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 @@ 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;