Author: sginsberg
Date: Wed Sep 24 14:13:08 2008
New Revision: 36494
URL:
http://svn.reactos.org/svn/reactos?rev=36494&view=rev
Log:
- MiQueryVirtualMemory shouldn't be called for kernel memory, so remove the special
case code for a kernel address space. Also fixes a case where we would dereference an
uninitialized pointer.
- Fix for Coverity Error CID: 773
Modified:
trunk/reactos/ntoskrnl/mm/virtual.c
Modified: trunk/reactos/ntoskrnl/mm/virtual.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/virtual.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/virtual.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/virtual.c [iso-8859-1] Wed Sep 24 14:13:08 2008
@@ -427,26 +427,21 @@
MEMORY_AREA* MemoryArea;
PMM_AVL_TABLE AddressSpace;
- if (Address < MmSystemRangeStart)
- {
- Status = ObReferenceObjectByHandle(ProcessHandle,
- PROCESS_QUERY_INFORMATION,
- NULL,
- UserMode,
- (PVOID*)(&Process),
- NULL);
-
- if (!NT_SUCCESS(Status))
- {
- DPRINT("NtQueryVirtualMemory() = %x\n",Status);
- return(Status);
- }
- AddressSpace = &Process->VadRoot;
- }
- else
- {
- AddressSpace = MmGetKernelAddressSpace();
- }
+ Status = ObReferenceObjectByHandle(ProcessHandle,
+ PROCESS_QUERY_INFORMATION,
+ NULL,
+ UserMode,
+ (PVOID*)(&Process),
+ NULL);
+
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("NtQueryVirtualMemory() = %x\n",Status);
+ return(Status);
+ }
+
+ AddressSpace = &Process->VadRoot;
+
MmLockAddressSpace(AddressSpace);
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, Address);
switch(VirtualMemoryInformationClass)
@@ -572,11 +567,7 @@
}
MmUnlockAddressSpace(AddressSpace);
- if (Address < MmSystemRangeStart)
- {
- ASSERT(Process);
- ObDereferenceObject(Process);
- }
+ ObDereferenceObject(Process);
return Status;
}