From b78cb36d910dd2e881844e96fd3e2c11cacd32cd Mon Sep 17 00:00:00 2001 From: Vadim Galyant Date: Thu, 2 Apr 2020 13:15:33 +0300 Subject: [PATCH] [NTOS:MM] Using the macro MiIsPteOnPdeBoundary(). (#2496) The SYSTEM_PD_SIZE constant should not be used to determine the page boundary for page tables. It is better to use the portable MiIsPteOnPdeBoundary() macro for this. --- ntoskrnl/mm/ARM3/section.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntoskrnl/mm/ARM3/section.c b/ntoskrnl/mm/ARM3/section.c index abac73207cd..7d4e45c4af8 100644 --- a/ntoskrnl/mm/ARM3/section.c +++ b/ntoskrnl/mm/ARM3/section.c @@ -647,7 +647,7 @@ MiSegmentDelete(IN PSEGMENT Segment) while (PointerPte < LastPte) { /* Check if it's time to switch master PTEs if we passed a PDE boundary */ - if (!((ULONG_PTR)PointerPte & (PD_SIZE - 1)) && + if (MiIsPteOnPdeBoundary(PointerPte) && (PointerPte != Subsection->SubsectionBase)) { /* Check if the master PTE is invalid */ @@ -2150,7 +2150,7 @@ MiSetProtectionOnSection(IN PEPROCESS Process, // // Check if we've crossed a PDE boundary and make the new PDE valid too // - if ((((ULONG_PTR)PointerPte) & (SYSTEM_PD_SIZE - 1)) == 0) + if (MiIsPteOnPdeBoundary(PointerPte)) { PointerPde = MiPteToPde(PointerPte); MiMakePdeExistAndMakeValid(PointerPde, Process, MM_NOIRQL);