Author: jgardou
Date: Sun Jul 10 19:24:49 2011
New Revision: 52616
URL:
http://svn.reactos.org/svn/reactos?rev=52616&view=rev
Log:
[NTOSKRNL/MM]
- The initial region does not necessarily begins with the asked address, calculate
remaining space acccordingly.
Modified:
trunk/reactos/ntoskrnl/mm/region.c
Modified: trunk/reactos/ntoskrnl/mm/region.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/region.c?rev=5…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/region.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/region.c [iso-8859-1] Sun Jul 10 19:24:49 2011
@@ -135,16 +135,20 @@
{
return(STATUS_NO_MEMORY);
}
+ if(NewRegion->Length < Length)
+ RemainingLength = Length - NewRegion->Length;
+ else
+ RemainingLength = 0;
}
else
{
NewRegion = InitialRegion;
- }
-
- if(NewRegion->Length < Length)
- RemainingLength = Length - NewRegion->Length;
- else
- RemainingLength = 0;
+ if(((ULONG_PTR)InitialBaseAddress + NewRegion->Length) <
+ ((ULONG_PTR)StartAddress + Length))
+ RemainingLength = ((ULONG_PTR)StartAddress + Length) -
((ULONG_PTR)InitialBaseAddress + NewRegion->Length);
+ else
+ RemainingLength = 0;
+ }
/*
* Free any complete regions that are containing in the range of addresses