mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 18:13:03 +00:00
- 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 svn path=/trunk/; revision=36494
This commit is contained in:
parent
a9d6e4341e
commit
ef2bb65235
1 changed files with 13 additions and 22 deletions
|
@ -427,26 +427,21 @@ MiQueryVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
MEMORY_AREA* MemoryArea;
|
MEMORY_AREA* MemoryArea;
|
||||||
PMM_AVL_TABLE AddressSpace;
|
PMM_AVL_TABLE AddressSpace;
|
||||||
|
|
||||||
if (Address < MmSystemRangeStart)
|
Status = ObReferenceObjectByHandle(ProcessHandle,
|
||||||
{
|
PROCESS_QUERY_INFORMATION,
|
||||||
Status = ObReferenceObjectByHandle(ProcessHandle,
|
NULL,
|
||||||
PROCESS_QUERY_INFORMATION,
|
UserMode,
|
||||||
NULL,
|
(PVOID*)(&Process),
|
||||||
UserMode,
|
NULL);
|
||||||
(PVOID*)(&Process),
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
|
||||||
DPRINT("NtQueryVirtualMemory() = %x\n",Status);
|
|
||||||
return(Status);
|
|
||||||
}
|
|
||||||
AddressSpace = &Process->VadRoot;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
AddressSpace = MmGetKernelAddressSpace();
|
DPRINT("NtQueryVirtualMemory() = %x\n",Status);
|
||||||
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AddressSpace = &Process->VadRoot;
|
||||||
|
|
||||||
MmLockAddressSpace(AddressSpace);
|
MmLockAddressSpace(AddressSpace);
|
||||||
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, Address);
|
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, Address);
|
||||||
switch(VirtualMemoryInformationClass)
|
switch(VirtualMemoryInformationClass)
|
||||||
|
@ -572,11 +567,7 @@ MiQueryVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
MmUnlockAddressSpace(AddressSpace);
|
MmUnlockAddressSpace(AddressSpace);
|
||||||
if (Address < MmSystemRangeStart)
|
ObDereferenceObject(Process);
|
||||||
{
|
|
||||||
ASSERT(Process);
|
|
||||||
ObDereferenceObject(Process);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue