https://git.reactos.org/?p=reactos.git;a=commitdiff;h=11eee4eeec8771c399988b68e4c7bb829d2405ff

commit 11eee4eeec8771c399988b68e4c7bb829d2405ff
Author:     Jérôme Gardou <[email protected]>
AuthorDate: Tue Dec 29 19:50:59 2020 +0100
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Wed Feb 3 09:41:23 2021 +0100

    [NTOS:MM] Check that we don't add rmap for NULL process
---
 ntoskrnl/mm/rmap.c | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/ntoskrnl/mm/rmap.c b/ntoskrnl/mm/rmap.c
index 80576f4cc59..c000953cca1 100644
--- a/ntoskrnl/mm/rmap.c
+++ b/ntoskrnl/mm/rmap.c
@@ -410,17 +410,11 @@ MmInsertRmap(PFN_NUMBER Page, PEPROCESS Process,
 
     if (!RMAP_IS_SEGMENT(Address))
     {
-        if (Process == NULL)
+        ASSERT(Process != NULL);
+        PrevSize = InterlockedExchangeAddUL(&Process->Vm.WorkingSetSize, 
PAGE_SIZE);
+        if (PrevSize >= Process->Vm.PeakWorkingSetSize)
         {
-            Process = PsInitialSystemProcess;
-        }
-        if (Process)
-        {
-            PrevSize = InterlockedExchangeAddUL(&Process->Vm.WorkingSetSize, 
PAGE_SIZE);
-            if (PrevSize >= Process->Vm.PeakWorkingSetSize)
-            {
-                Process->Vm.PeakWorkingSetSize = PrevSize + PAGE_SIZE;
-            }
+            Process->Vm.PeakWorkingSetSize = PrevSize + PAGE_SIZE;
         }
     }
 }
@@ -455,14 +449,8 @@ MmDeleteRmap(PFN_NUMBER Page, PEPROCESS Process,
             ExFreeToNPagedLookasideList(&RmapLookasideList, current_entry);
             if (!RMAP_IS_SEGMENT(Address))
             {
-                if (Process == NULL)
-                {
-                    Process = PsInitialSystemProcess;
-                }
-                if (Process)
-                {
-                    
(void)InterlockedExchangeAddUL(&Process->Vm.WorkingSetSize, -PAGE_SIZE);
-                }
+                ASSERT(Process != NULL);
+                (void)InterlockedExchangeAddUL(&Process->Vm.WorkingSetSize, 
-PAGE_SIZE);
             }
             return;
         }

Reply via email to