mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Fix MmAllocatePageForMdl when it cannot allocate as much memory as requested.
svn path=/trunk/; revision=13042
This commit is contained in:
parent
c4f5066636
commit
6182a1c5f7
1 changed files with 12 additions and 4 deletions
|
@ -638,7 +638,6 @@ MmAllocatePagesForMdl ( IN PHYSICAL_ADDRESS LowAddress,
|
||||||
sub-MDL it must map the sub-MDL using MmGetSystemAddressForMdlSafe.
|
sub-MDL it must map the sub-MDL using MmGetSystemAddressForMdlSafe.
|
||||||
|
|
||||||
Konstantin Gusev
|
Konstantin Gusev
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PMDL Mdl;
|
PMDL Mdl;
|
||||||
|
@ -652,7 +651,11 @@ MmAllocatePagesForMdl ( IN PHYSICAL_ADDRESS LowAddress,
|
||||||
SkipBytes.QuadPart, Totalbytes);
|
SkipBytes.QuadPart, Totalbytes);
|
||||||
|
|
||||||
/* SkipBytes must be a multiple of the page size */
|
/* SkipBytes must be a multiple of the page size */
|
||||||
ASSERT((SkipBytes.QuadPart % PAGE_SIZE) == 0);
|
if ((SkipBytes.QuadPart % PAGE_SIZE) != 0)
|
||||||
|
{
|
||||||
|
DPRINT1("Warning: SkipBytes is not a multiple of PAGE_SIZE\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Allocate memory for the MDL */
|
/* Allocate memory for the MDL */
|
||||||
Mdl = MmCreateMdl(NULL, 0, Totalbytes);
|
Mdl = MmCreateMdl(NULL, 0, Totalbytes);
|
||||||
|
@ -690,6 +693,11 @@ MmAllocatePagesForMdl ( IN PHYSICAL_ADDRESS LowAddress,
|
||||||
ExFreePool(Mdl);
|
ExFreePool(Mdl);
|
||||||
Mdl = NULL;
|
Mdl = NULL;
|
||||||
}
|
}
|
||||||
|
else if (NumberOfPagesWanted > 0)
|
||||||
|
{
|
||||||
|
Mdl->ByteCount = (ULONG)(NumberOfPagesAllocated * PAGE_SIZE);
|
||||||
|
/* FIXME: I don't know if Mdl->Size should also be changed -- blight */
|
||||||
|
}
|
||||||
return Mdl;
|
return Mdl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue