From 729f2f890bc42f3b24e64121e903c999d64ce9ef Mon Sep 17 00:00:00 2001 From: p-szafonimateusz Date: Thu, 25 Sep 2025 13:32:39 +0200 Subject: [PATCH] fs/mmap/fs_mmap.c: MAP_PRIVATE or MAP_SHARED must be specified MAP_PRIVATE or MAP_SHARED must be specified in flags according to standard Signed-off-by: p-szafonimateusz --- fs/mmap/fs_mmap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/mmap/fs_mmap.c b/fs/mmap/fs_mmap.c index 1739b03d36c..6a471a723a8 100644 --- a/fs/mmap/fs_mmap.c +++ b/fs/mmap/fs_mmap.c @@ -82,6 +82,13 @@ static int file_mmap_(FAR struct file *filep, FAR void *start, return -EINVAL; } + /* MAP_PRIVATE or MAP_SHARED must be specified */ + + if (((flags & MAP_PRIVATE) == 0) && ((flags & MAP_SHARED) == 0)) + { + return -EINVAL; + } + /* Fixed mappings and protections are not currently supported. These * options could be supported in the KERNEL build with an MMU, but that * logic is not in place.