aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Brown <kbrown@cornell.edu>2024-12-18 11:43:09 -0500
committerKen Brown <kbrown@cornell.edu>2024-12-19 10:40:18 -0500
commit67bef16f7edf8642366ff55399bf9cf007c66d52 (patch)
tree8e7786e241a88f834002f93706f76736651223ab
parent677e3150907a83f17e50d546f79b7ca863ebd77d (diff)
downloadnewlib-67bef16f7edf8642366ff55399bf9cf007c66d52.zip
newlib-67bef16f7edf8642366ff55399bf9cf007c66d52.tar.gz
newlib-67bef16f7edf8642366ff55399bf9cf007c66d52.tar.bz2
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>
-rw-r--r--winsup/cygwin/mm/mmap.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/winsup/cygwin/mm/mmap.cc b/winsup/cygwin/mm/mmap.cc
index 4fec64b..13418d7 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. */