[newlib-cygwin/main] Cygwin: mmap_list::try_map: fix a condition in a test of an mmap request
Ken Brown
kbrown@sourceware.org
Thu Dec 19 16:03:25 GMT 2024
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=67bef16f7edf8642366ff55399bf9cf007c66d52
commit 67bef16f7edf8642366ff55399bf9cf007c66d52
Author: Ken Brown <kbrown@cornell.edu>
Date: Wed Dec 18 11:43:09 2024 -0500
Cygwin: mmap_list::try_map: fix a condition in a test of an mmap request
In testing whether the requested area is contained in an existing
mapped region, an incorrect condition was used due to a
misinterpretation of the u_addr and u_len variables.
Addresses: https://cygwin.com/pipermail/cygwin/2024-December/256913.html
Fixes: c68de3a262fe5 ("* mmap.cc (class mmap_record):
Declare new map_pages method with address parameter.")
Signed-off-by: Ken Brown <kbrown@cornell.edu>
Diff:
---
winsup/cygwin/mm/mmap.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/winsup/cygwin/mm/mmap.cc b/winsup/cygwin/mm/mmap.cc
index 4fec64b87..13418d782 100644
--- a/winsup/cygwin/mm/mmap.cc
+++ b/winsup/cygwin/mm/mmap.cc
@@ -651,7 +651,7 @@ mmap_list::try_map (void *addr, size_t len, int new_prot, int flags, off_t off)
break;
if (rec)
{
- if (u_addr > (caddr_t) addr || u_addr + len < (caddr_t) addr + len
+ if (u_addr > (caddr_t) addr || u_addr + u_len < (caddr_t) addr + len
|| !rec->compatible_flags (flags))
{
/* Partial match only, or access mode doesn't match. */
More information about the Cygwin-cvs
mailing list