mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:17:35 +00:00
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:
parent
89502fc329
commit
1b8012e5c7
1 changed files with 3 additions and 0 deletions
|
@ -868,6 +868,9 @@ u32 Emulator::virt$mmap(u32 params_addr)
|
|||
mmu().copy_from_vm(¶ms, 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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue