fs/mmap/fs_munmap.c: return error if len is 0

munmap() shall return ERROR with errno = EINVAL if len is 0

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
This commit is contained in:
p-szafonimateusz 2025-09-26 12:57:04 +02:00 committed by Xiang Xiao
parent 3f55710184
commit 7439e49db8

View file

@ -55,6 +55,11 @@ static int file_munmap_(FAR void *start, size_t length,
FAR struct mm_map_s *mm = get_current_mm();
int ret = OK;
if (length == 0)
{
return -EINVAL;
}
/* Iterate through all the mappings and call the underlying
* unmap for every mapping where "start" lies
* break loop on any errors.