[ros-diffs] [ros-arm-bringup] 41505: - 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.

ros-arm-bringup at svn.reactos.org ros-arm-bringup at svn.reactos.org
Sun Jun 21 06:09:26 CEST 2009


Author: ros-arm-bringup
Date: Sun Jun 21 08:09:25 2009
New Revision: 41505

URL: http://svn.reactos.org/svn/reactos?rev=41505&view=rev
Log:
- 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.


Modified:
    trunk/reactos/ntoskrnl/include/internal/mm.h

Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/mm.h?rev=41505&r1=41504&r2=41505&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Sun Jun 21 08:09:25 2009
@@ -352,6 +352,9 @@
     } u4;
 } MMPFN, *PMMPFN;
 
+extern PMMPFN MmPageArray;
+extern ULONG MmPageArraySize;
+
 extern MM_STATS MmStats;
 
 typedef struct _MM_PAGEOP
@@ -1036,14 +1039,9 @@
 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];



More information about the Ros-diffs mailing list