This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 616b56876da fs/mmap: skip writeback for read-only RAM mappings
616b56876da is described below

commit 616b56876daf7d91ad90825bc12d68a6b8b93c23
Author: jingfei <[email protected]>
AuthorDate: Fri Nov 27 20:29:46 2026 +0800

    fs/mmap: skip writeback for read-only RAM mappings
    
    A read-only RAM mapping has no writable changes to synchronize. Apply
    the same write-protection check used by unmap_rammap before seeking or
    writing to its backing file.
    
    Signed-off-by: jingfei <[email protected]>
---
 fs/mmap/fs_rammap.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/mmap/fs_rammap.c b/fs/mmap/fs_rammap.c
index f043ecdbdc4..4cbda14856d 100644
--- a/fs/mmap/fs_rammap.c
+++ b/fs/mmap/fs_rammap.c
@@ -66,6 +66,11 @@ static int msync_rammap(FAR struct mm_map_entry_s *entry, 
FAR void *start,
   off_t fpos;
   off_t opos;
 
+  if ((entry->prot & PROT_WRITE) == 0)
+    {
+      return OK;
+    }
+
   offset = (uintptr_t)start - (uintptr_t)entry->vaddr;
   if (length > entry->length - offset)
     {

Reply via email to