Fix range check. The previous check would produce an off by one error making the

last byte of an unmapped-but-still-there page non-readable (i.e. from B_NO_LOCK
areas), causing such reads to fail in KDL.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42276 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2011-06-21 13:06:26 +00:00
parent 97184c6965
commit 6244ea5051

View File

@ -4839,8 +4839,8 @@ status_t
vm_debug_copy_page_memory(team_id teamID, void* unsafeMemory, void* buffer,
size_t size, bool copyToUnsafe)
{
if (size > B_PAGE_SIZE
|| ((addr_t)unsafeMemory + size) % B_PAGE_SIZE < size) {
if (size > B_PAGE_SIZE || ROUNDDOWN((addr_t)unsafeMemory, B_PAGE_SIZE)
!= ROUNDDOWN((addr_t)unsafeMemory + size - 1, B_PAGE_SIZE)) {
return B_BAD_VALUE;
}