if (Page == PAGE_ALIGN(LinearAddress + Size - 1))
{
/* Read only a part of the page */
- PageLength = PAGE_OFFSET(LinearAddress) + Size - PageOffset;
+ PageLength = PAGE_OFFSET(LinearAddress + Size - 1) - PageOffset + 1;
}
/* Read the memory */
if (Page == PAGE_ALIGN(LinearAddress + Size - 1))
{
/* Write only a part of the page */
- PageLength = PAGE_OFFSET(LinearAddress) + Size - PageOffset;
+ PageLength = PAGE_OFFSET(LinearAddress + Size - 1) - PageOffset + 1;
}
/* Write the memory */