https://git.reactos.org/?p=reactos.git;a=commitdiff;h=259180a568d688e4e07585ff07502ed98562edb8

commit 259180a568d688e4e07585ff07502ed98562edb8
Author:     Thamatip Chitpong <thamatip.chitp...@reactos.org>
AuthorDate: Mon Oct 7 15:56:29 2024 +0700
Commit:     GitHub <nore...@github.com>
CommitDate: Mon Oct 7 15:56:29 2024 +0700

    [NTOS:MM] MmFlushSegment: Simplify return (#7422)
---
 ntoskrnl/mm/section.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/ntoskrnl/mm/section.c b/ntoskrnl/mm/section.c
index 0e4c0e1bcc7..1949d026149 100644
--- a/ntoskrnl/mm/section.c
+++ b/ntoskrnl/mm/section.c
@@ -4961,9 +4961,7 @@ MmFlushSegment(
     if (!Segment)
     {
         /* Nothing to flush */
-        if (Iosb)
-            Iosb->Status = STATUS_SUCCESS;
-        return STATUS_SUCCESS;
+        goto Quit;
     }
 
     ASSERT(*Segment->Flags & MM_DATAFILE_SEGMENT);
@@ -4976,17 +4974,12 @@ MmFlushSegment(
 
         /* FIXME: All of this is suboptimal */
         ULONG ElemCount = RtlNumberGenericTableElements(&Segment->PageTable);
-        /* No page. Nothing to flush */
         if (!ElemCount)
         {
+            /* No page. Nothing to flush */
             MmUnlockSectionSegment(Segment);
             MmDereferenceSegment(Segment);
-            if (Iosb)
-            {
-                Iosb->Status = STATUS_SUCCESS;
-                Iosb->Information = 0;
-            }
-            return STATUS_SUCCESS;
+            goto Quit;
         }
 
         PCACHE_SECTION_PAGE_TABLE PageTable = 
RtlGetElementGenericTable(&Segment->PageTable, ElemCount - 1);
@@ -5014,6 +5007,8 @@ MmFlushSegment(
     MmUnlockSectionSegment(Segment);
     MmDereferenceSegment(Segment);
 
+Quit:
+    /* FIXME: Handle failures */
     if (Iosb)
         Iosb->Status = STATUS_SUCCESS;
 

Reply via email to