Browse Source

vm_manager: Use range helpers in HeapAlloc() and HeapFree()

Significantly tidies up two guard conditionals.
nce_cpp
Lioncash 7 years ago
parent
commit
dc51694993
  1. 6
      src/core/hle/kernel/vm_manager.cpp

6
src/core/hle/kernel/vm_manager.cpp

@ -257,8 +257,7 @@ ResultCode VMManager::ReprotectRange(VAddr target, u64 size, VMAPermission new_p
}
ResultVal<VAddr> VMManager::HeapAllocate(VAddr target, u64 size, VMAPermission perms) {
if (target < GetHeapRegionBaseAddress() || target + size > GetHeapRegionEndAddress() ||
target + size < target) {
if (!IsWithinHeapRegion(target, size)) {
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) {
if (target < GetHeapRegionBaseAddress() || target + size > GetHeapRegionEndAddress() ||
target + size < target) {
if (!IsWithinHeapRegion(target, size)) {
return ERR_INVALID_ADDRESS;
}

Loading…
Cancel
Save