diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2022-08-10 18:03:05 +0200 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2022-08-10 18:05:12 +0200 |
commit | 56b7fd620fce86ab86cae2d22985cf7a385e3c5b (patch) | |
tree | 048e74edc07c53c0fd0d1081d97bc72f8144134e /winsup/cygwin/mm | |
parent | 9fbfccff717521641eb52de7581a98bbae35e75f (diff) | |
download | newlib-56b7fd620fce86ab86cae2d22985cf7a385e3c5b.zip newlib-56b7fd620fce86ab86cae2d22985cf7a385e3c5b.tar.gz newlib-56b7fd620fce86ab86cae2d22985cf7a385e3c5b.tar.bz2 |
Cygwin: make check_invalid_virtual_addr a static inline function
move it to mm/mmap.cc which uses it exclusively.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/mm')
-rw-r--r-- | winsup/cygwin/mm/mmap.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/winsup/cygwin/mm/mmap.cc b/winsup/cygwin/mm/mmap.cc index 4f38362..c33342b 100644 --- a/winsup/cygwin/mm/mmap.cc +++ b/winsup/cygwin/mm/mmap.cc @@ -1112,6 +1112,19 @@ out: /* munmap () removes all mmapped pages between addr and addr+len. */ +static inline int +check_invalid_virtual_addr (const void *s, unsigned sz) +{ + MEMORY_BASIC_INFORMATION mbuf; + const void *end; + + for (end = (char *) s + sz; s < end; + s = (char *) mbuf.BaseAddress + mbuf.RegionSize) + if (!VirtualQuery (s, &mbuf, sizeof mbuf)) + return EINVAL; + return 0; +} + extern "C" int munmap (void *addr, size_t len) { |