[NTOSKRNL]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 17 May 2014 22:30:43 +0000 (22:30 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 17 May 2014 22:30:43 +0000 (22:30 +0000)
Fix Mm

svn path=/trunk/; revision=63338

reactos/ntoskrnl/mm/ARM3/virtual.c

index a2871f7..ea2f094 100644 (file)
@@ -4409,13 +4409,18 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
                                                        &StartingAddress);
             }
 
-            if (Result == TableFoundNode) goto FailPath;
+            if (Result == TableFoundNode)
+            {
+                Status = STATUS_NO_MEMORY;
+                goto FailPath;
+            }
 
             //
             // Now we know where the allocation ends. Make sure it doesn't end up
             // somewhere in kernel mode.
             //
-            EndingAddress = ((ULONG_PTR)StartingAddress + PRegionSize - 1) | (PAGE_SIZE - 1);
+            NT_ASSERT(StartingAddress != 0);
+            EndingAddress = (StartingAddress + PRegionSize - 1) | (PAGE_SIZE - 1);
             if ((PVOID)EndingAddress > MM_HIGHEST_VAD_ADDRESS)
             {
                 Status = STATUS_NO_MEMORY;