[CMAKE]
[reactos.git] / ntoskrnl / mm / marea.c
index e2a8243..cacf2ae 100644 (file)
@@ -493,13 +493,16 @@ MmFindGapBottomUp(
          break;
 
       AlignedAddress = MM_ROUND_UP(PreviousNode->EndingAddress, Granularity);
-      if (Node->StartingAddress > AlignedAddress &&
-          (ULONG_PTR)Node->StartingAddress - (ULONG_PTR)AlignedAddress >= Length)
+      if (AlignedAddress >= LowestAddress)
       {
-         DPRINT("MmFindGapBottomUp: %p\n", AlignedAddress);
-         return AlignedAddress;
+          if (Node->StartingAddress > AlignedAddress &&
+              (ULONG_PTR)Node->StartingAddress - (ULONG_PTR)AlignedAddress >= Length)
+          {
+             DPRINT("MmFindGapBottomUp: %p\n", AlignedAddress);
+             ASSERT(AlignedAddress >= LowestAddress);
+             return AlignedAddress;
+          }
       }
-
       PreviousNode = Node;
    }
 
@@ -509,6 +512,7 @@ MmFindGapBottomUp(
        (ULONG_PTR)HighestAddress - (ULONG_PTR)AlignedAddress >= Length)
    {
       DPRINT("MmFindGapBottomUp: %p\n", AlignedAddress);
+      ASSERT(AlignedAddress >= LowestAddress);
       return AlignedAddress;
    }
 
@@ -518,6 +522,7 @@ MmFindGapBottomUp(
        (ULONG_PTR)FirstNode->StartingAddress - (ULONG_PTR)AlignedAddress >= Length)
    {
       DPRINT("MmFindGapBottomUp: %p\n", AlignedAddress);
+      ASSERT(AlignedAddress >= LowestAddress);
       return AlignedAddress;
    }