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.
This commit is contained in:
Augustin Cavalier 2025-01-13 15:00:54 -05:00
parent c125a32508
commit e0f5c2e5cd

View File

@ -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;
}