UserspaceEmulator: Fail with EINVAL for mmap with size 0

This is the behaviour specified by POSIX and also the behaviour of the
real kernel, so let's follow that while emulating.
This commit is contained in:
Rummskartoffel 2022-01-08 21:34:19 +01:00 committed by Andreas Kling
parent 89502fc329
commit 1b8012e5c7

View file

@ -868,6 +868,9 @@ u32 Emulator::virt$mmap(u32 params_addr)
mmu().copy_from_vm(&params, params_addr, sizeof(params));
params.alignment = params.alignment ? params.alignment : PAGE_SIZE;
if (params.size == 0)
return -EINVAL;
u32 requested_size = round_up_to_power_of_two(params.size, PAGE_SIZE);
FlatPtr final_address;