RTEMS | posix: fix mmap boundary check (!1297)

Yang Zhang (@Chloe) gitlab at rtems.org
Tue Jun 9 09:26:48 UTC 2026



Yang Zhang created a merge request: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1297

Project:Branches: Chloe/rtems:fix-posix-mmap to rtems/rtos/rtems:main
Author:   Yang Zhang



## Summary

posix: fix mmap boundary check

The inclusive comparison against st_size incorrectly rejects mappings ending exactly at the file boundary.

This patch: 

1.Changes \>= to \> to allow valid mappings up to the file size. 

2.Uses subtraction-based logic to prevent potential integer overflow.

## Generative AI

<!--If you have used AI please use the "AI Contribution" template otherwise leave this blank see our fulls statement at https://www.rtems.org/generative-ai/-->

<!--Default settings, if it is a dropdown it will set after submission-->

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1297
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260609/3a9609cc/attachment-0001.htm>


More information about the bugs mailing list