From f7ed5bd01d3371d6b1393888bf9dbdb7641f4a9c Mon Sep 17 00:00:00 2001 From: ReactOS Portable Systems Group Date: Sun, 21 Jun 2009 04:09:25 +0000 Subject: [PATCH] - It is very possible for MiGetPfnEntry to be called for a page above the page array size, since not all pages are represented in the array. In this scenario, MiGetPfnEntry should return NULL (and the caller should be prepared for this scenario). - Also move out the extern definitions outside of the inline, so that other functions may access them and consequently removing a needless UNREFERENCED_PARAMETER. svn path=/trunk/; revision=41505 --- reactos/ntoskrnl/include/internal/mm.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/reactos/ntoskrnl/include/internal/mm.h b/reactos/ntoskrnl/include/internal/mm.h index e51db265fa1..e92c1dc7343 100644 --- a/reactos/ntoskrnl/include/internal/mm.h +++ b/reactos/ntoskrnl/include/internal/mm.h @@ -352,6 +352,9 @@ typedef struct _MMPFN } u4; } MMPFN, *PMMPFN; +extern PMMPFN MmPageArray; +extern ULONG MmPageArraySize; + extern MM_STATS MmStats; typedef struct _MM_PAGEOP @@ -1036,14 +1039,9 @@ PMMPFN MiGetPfnEntry(IN PFN_TYPE Pfn) { PMMPFN Page; - extern PMMPFN MmPageArray; - extern ULONG MmPageArraySize; - - /* Mark MmPageArraySize as unreferenced, otherwise it will appear as an unused variable on a Release build */ - UNREFERENCED_PARAMETER(MmPageArraySize); /* Make sure the PFN number is valid */ - ASSERT(Pfn <= MmPageArraySize); + if (Pfn > MmPageArraySize) return NULL; /* Get the entry */ Page = &MmPageArray[Pfn];