mirror of
https://github.com/reactos/reactos.git
synced 2025-04-04 04:26:32 +00:00
[NTOSKRNL] Properly align VACB writes
Also simplify VACB reads alignment code. Also add some sanity ASSERTs.
This commit is contained in:
parent
f7b9db0f66
commit
2a80ae2bb6
1 changed files with 9 additions and 4 deletions
|
@ -81,7 +81,7 @@ NTAPI
|
|||
CcReadVirtualAddress (
|
||||
PROS_VACB Vacb)
|
||||
{
|
||||
ULONG Size, Pages;
|
||||
ULONG Size;
|
||||
PMDL Mdl;
|
||||
NTSTATUS Status;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
|
@ -95,10 +95,11 @@ CcReadVirtualAddress (
|
|||
}
|
||||
Size = LargeSize.LowPart;
|
||||
|
||||
Pages = BYTES_TO_PAGES(Size);
|
||||
ASSERT(Pages * PAGE_SIZE <= VACB_MAPPING_GRANULARITY);
|
||||
Size = ROUND_TO_PAGES(Size);
|
||||
ASSERT(Size <= VACB_MAPPING_GRANULARITY);
|
||||
ASSERT(Size > 0);
|
||||
|
||||
Mdl = IoAllocateMdl(Vacb->BaseAddress, Pages * PAGE_SIZE, FALSE, FALSE, NULL);
|
||||
Mdl = IoAllocateMdl(Vacb->BaseAddress, Size, FALSE, FALSE, NULL);
|
||||
if (!Mdl)
|
||||
{
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
@ -177,6 +178,10 @@ CcWriteVirtualAddress (
|
|||
} while (++i < (Size >> PAGE_SHIFT));
|
||||
}
|
||||
|
||||
Size = ROUND_TO_PAGES(Size);
|
||||
ASSERT(Size <= VACB_MAPPING_GRANULARITY);
|
||||
ASSERT(Size > 0);
|
||||
|
||||
Mdl = IoAllocateMdl(Vacb->BaseAddress, Size, FALSE, FALSE, NULL);
|
||||
if (!Mdl)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue