public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: make check_invalid_virtual_addr a static inline function Date: Wed, 10 Aug 2022 16:13:46 +0000 (GMT) [thread overview] Message-ID: <20220810161346.767F3385C8B1@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=56b7fd620fce86ab86cae2d22985cf7a385e3c5b commit 56b7fd620fce86ab86cae2d22985cf7a385e3c5b Author: Corinna Vinschen <corinna@vinschen.de> Date: Wed Aug 10 18:03:05 2022 +0200 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> Diff: --- winsup/cygwin/local_includes/miscfuncs.h | 3 --- winsup/cygwin/miscfuncs.cc | 13 ------------- winsup/cygwin/mm/mmap.cc | 13 +++++++++++++ 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/winsup/cygwin/local_includes/miscfuncs.h b/winsup/cygwin/local_includes/miscfuncs.h index fc791c2aa..eac1dbe20 100644 --- a/winsup/cygwin/local_includes/miscfuncs.h +++ b/winsup/cygwin/local_includes/miscfuncs.h @@ -101,9 +101,6 @@ PWCHAR transform_chars_af_unix (PWCHAR, const char *, __socklen_t); /* Get handle count of an object. */ ULONG get_obj_handle_count (HANDLE h); -/* Memory checking */ -int check_invalid_virtual_addr (const void *s, unsigned sz); - ssize_t check_iovec (const struct iovec *, int, bool); #define check_iovec_for_read(a, b) check_iovec ((a), (b), false) #define check_iovec_for_write(a, b) check_iovec ((a), (b), true) diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc index 1513bc04e..f46e349e5 100644 --- a/winsup/cygwin/miscfuncs.cc +++ b/winsup/cygwin/miscfuncs.cc @@ -37,19 +37,6 @@ get_obj_handle_count (HANDLE h) return hdl_cnt; } -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; -} - static char __attribute__ ((noinline)) dummytest (volatile char *p) { diff --git a/winsup/cygwin/mm/mmap.cc b/winsup/cygwin/mm/mmap.cc index 4f383627a..c33342bc3 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) {
reply other threads:[~2022-08-10 16:13 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220810161346.767F3385C8B1@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).