[NTOS]: Fix a bug in MmFindGapBottomUp which could make it return an address lower than what the caller said should be the lowest address.

svn path=/trunk/; revision=49439
This commit is contained in:
Sir Richard 2010-11-02 14:50:06 +00:00
parent 36429c0a64
commit c7b69d59e3

View file

@ -492,13 +492,16 @@ MmFindGapBottomUp(
break;
AlignedAddress = MM_ROUND_UP(PreviousNode->EndingAddress, Granularity);
if (AlignedAddress >= LowestAddress)
{
if (Node->StartingAddress > AlignedAddress &&
(ULONG_PTR)Node->StartingAddress - (ULONG_PTR)AlignedAddress >= Length)
{
DPRINT("MmFindGapBottomUp: %p\n", AlignedAddress);
ASSERT(AlignedAddress >= LowestAddress);
return AlignedAddress;
}
}
PreviousNode = Node;
}
@ -508,6 +511,7 @@ MmFindGapBottomUp(
(ULONG_PTR)HighestAddress - (ULONG_PTR)AlignedAddress >= Length)
{
DPRINT("MmFindGapBottomUp: %p\n", AlignedAddress);
ASSERT(AlignedAddress >= LowestAddress);
return AlignedAddress;
}
@ -517,6 +521,7 @@ MmFindGapBottomUp(
(ULONG_PTR)FirstNode->StartingAddress - (ULONG_PTR)AlignedAddress >= Length)
{
DPRINT("MmFindGapBottomUp: %p\n", AlignedAddress);
ASSERT(AlignedAddress >= LowestAddress);
return AlignedAddress;
}