Explorar o código

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

Significantly tidies up two guard conditionals.
Lioncash %!s(int64=7) %!d(string=hai) anos
pai
achega
40de7f6fe8
Modificáronse 1 ficheiros con 2 adicións e 4 borrados
  1. 2 4
      src/core/hle/kernel/vm_manager.cpp

+ 2 - 4
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;
     }