From 259180a568d688e4e07585ff07502ed98562edb8 Mon Sep 17 00:00:00 2001 From: Thamatip Chitpong Date: Mon, 7 Oct 2024 15:56:29 +0700 Subject: [PATCH] [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;