From 539c31658985005bf22a9fb03b967d7bbae1417d Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 14 Apr 2023 10:34:21 +0300 Subject: [PATCH] [NTOS:Mm] Fix some 64 bit issues --- ntoskrnl/mm/i386/page.c | 2 +- ntoskrnl/mm/pagefile.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ntoskrnl/mm/i386/page.c b/ntoskrnl/mm/i386/page.c index 38cd5066256..e0f7a304c8b 100644 --- a/ntoskrnl/mm/i386/page.c +++ b/ntoskrnl/mm/i386/page.c @@ -598,7 +598,7 @@ MmCreatePageFileMapping(PEPROCESS Process, /* And we don't support creating for other process */ ASSERT(Process == PsGetCurrentProcess()); - if (SwapEntry & (1 << 31)) + if (SwapEntry & (1 << (sizeof(SWAPENTRY) - 1))) { KeBugCheck(MEMORY_MANAGEMENT); } diff --git a/ntoskrnl/mm/pagefile.c b/ntoskrnl/mm/pagefile.c index a57c4de0304..ae15771cad2 100644 --- a/ntoskrnl/mm/pagefile.c +++ b/ntoskrnl/mm/pagefile.c @@ -152,7 +152,7 @@ MmWriteToSwapPage(SWAPENTRY SwapEntry, PFN_NUMBER Page) IO_STATUS_BLOCK Iosb; NTSTATUS Status; KEVENT Event; - UCHAR MdlBase[sizeof(MDL) + sizeof(ULONG)]; + UCHAR MdlBase[sizeof(MDL) + sizeof(PFN_NUMBER)]; PMDL Mdl = (PMDL)MdlBase; DPRINT("MmWriteToSwapPage\n"); @@ -217,7 +217,7 @@ MiReadPageFile( IO_STATUS_BLOCK Iosb; NTSTATUS Status; KEVENT Event; - UCHAR MdlBase[sizeof(MDL) + sizeof(ULONG)]; + UCHAR MdlBase[sizeof(MDL) + sizeof(PFN_NUMBER)]; PMDL Mdl = (PMDL)MdlBase; PMMPAGING_FILE PagingFile;