From 4cae592ec28c9bd73ee22752d57cf3948cef401d Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Sun, 20 Mar 2005 12:04:30 +0000 Subject: [PATCH] Fix nasty condition when we were subtracting AlignedAddress (which happened to be aligned to 0x80000000) from HighestAddress (which is MmSystemRangeStart - 1 == 0x7fffffff) and then using it for length comparsion. svn path=/trunk/; revision=14214 --- reactos/ntoskrnl/mm/marea.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/mm/marea.c b/reactos/ntoskrnl/mm/marea.c index 6830f995a38..65b3c9a3e26 100644 --- a/reactos/ntoskrnl/mm/marea.c +++ b/reactos/ntoskrnl/mm/marea.c @@ -491,7 +491,8 @@ MmFindGapBottomUp( /* Check if there is enough space after the last memory area. */ AlignedAddress = MM_ROUND_UP(PreviousNode->EndingAddress, Granularity); - if ((ULONG_PTR)HighestAddress - (ULONG_PTR)AlignedAddress >= Length) + if ((ULONG_PTR)HighestAddress > (ULONG_PTR)AlignedAddress && + (ULONG_PTR)HighestAddress - (ULONG_PTR)AlignedAddress >= Length) { DPRINT("MmFindGapBottomUp: %p\n", AlignedAddress); return AlignedAddress;