vm_manager: Use range helpers in HeapAlloc() and HeapFree()
Significantly tidies up two guard conditionals.
This commit is contained in:
parent
6c42a23550
commit
40de7f6fe8
1 changed files with 2 additions and 4 deletions
|
@ -257,8 +257,7 @@ ResultCode VMManager::ReprotectRange(VAddr target, u64 size, VMAPermission new_p
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<VAddr> VMManager::HeapAllocate(VAddr target, u64 size, VMAPermission perms) {
|
ResultVal<VAddr> VMManager::HeapAllocate(VAddr target, u64 size, VMAPermission perms) {
|
||||||
if (target < GetHeapRegionBaseAddress() || target + size > GetHeapRegionEndAddress() ||
|
if (!IsWithinHeapRegion(target, size)) {
|
||||||
target + size < target) {
|
|
||||||
return ERR_INVALID_ADDRESS;
|
return ERR_INVALID_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,8 +292,7 @@ ResultVal<VAddr> VMManager::HeapAllocate(VAddr target, u64 size, VMAPermission p
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode VMManager::HeapFree(VAddr target, u64 size) {
|
ResultCode VMManager::HeapFree(VAddr target, u64 size) {
|
||||||
if (target < GetHeapRegionBaseAddress() || target + size > GetHeapRegionEndAddress() ||
|
if (!IsWithinHeapRegion(target, size)) {
|
||||||
target + size < target) {
|
|
||||||
return ERR_INVALID_ADDRESS;
|
return ERR_INVALID_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue