From e0f5c2e5cdc82008f422e11ec385ec771b7ddfdd Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Mon, 13 Jan 2025 15:00:54 -0500 Subject: [PATCH] kernel/vm: Distinguish reserved areas from non-existent areas in vm_area_for. RESERVED_AREA_ID == -1, so previously they weren't distinguishable. Now we return a different error code for an address that's in a reserved area. --- src/system/kernel/vm/vm.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/system/kernel/vm/vm.cpp b/src/system/kernel/vm/vm.cpp index f56eefda37..d04e466c12 100644 --- a/src/system/kernel/vm/vm.cpp +++ b/src/system/kernel/vm/vm.cpp @@ -3467,6 +3467,9 @@ vm_area_for(addr_t address, bool kernel) && (area->protection & (B_READ_AREA | B_WRITE_AREA | B_CLONEABLE_AREA)) == 0) return B_ERROR; + if (area->id == RESERVED_AREA_ID) + return EADDRINUSE; + return area->id; }