public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: fix initializing MEM_EXTENDED_PARAMETER, take 2
@ 2021-09-08  8:17 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2021-09-08  8:17 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=8fba45f0ccc3b936edfb93671141bf3fe0b0ee5e

commit 8fba45f0ccc3b936edfb93671141bf3fe0b0ee5e
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Wed Sep 8 10:07:46 2021 +0200

    Cygwin: fix initializing MEM_EXTENDED_PARAMETER, take 2
    
    In https://cygwin.com/pipermail/cygwin/2021-September/249361.html
    Brian pointed out that initializing the structure would be more
    future proof, should the developers at Microsoft ever decide to
    split the Reserved field and use some bits of the struct for
    other purposes.
    
    Fixes: 3d322ac930ca ("Cygwin: fix initializing MEM_EXTENDED_PARAMETER")
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/miscfuncs.cc | 6 ++----
 winsup/cygwin/mmap.cc      | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
index b544e7125..024ad70ba 100644
--- a/winsup/cygwin/miscfuncs.cc
+++ b/winsup/cygwin/miscfuncs.cc
@@ -517,9 +517,8 @@ class thread_allocator
       THREAD_STACK_SLOT
     };
     /* g++ 11.2 workaround: don't use initializer */
-    MEM_EXTENDED_PARAMETER thread_ext;
+    MEM_EXTENDED_PARAMETER thread_ext = { 0 };
     thread_ext.Type = MemExtendedParameterAddressRequirements;
-    thread_ext.Reserved = 0;
     thread_ext.Pointer = (PVOID) &thread_req;
 
     SIZE_T real_size = roundup2 (size, THREAD_STACK_SLOT);
@@ -539,9 +538,8 @@ class thread_allocator
 	  THREAD_STACK_SLOT
 	};
 	/* g++ 11.2 workaround: don't use initializer */
-	MEM_EXTENDED_PARAMETER mmap_ext;
+	MEM_EXTENDED_PARAMETER mmap_ext = { 0 };
 	mmap_ext.Type = MemExtendedParameterAddressRequirements;
-	mmap_ext.Reserved = 0;
 	mmap_ext.Pointer = (PVOID) &mmap_req;
 
 	real_stackaddr = VirtualAlloc2 (GetCurrentProcess(), NULL, real_size,
diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc
index 2e202a047..7982fd18e 100644
--- a/winsup/cygwin/mmap.cc
+++ b/winsup/cygwin/mmap.cc
@@ -207,9 +207,8 @@ MapView (HANDLE h, void *addr, size_t len, DWORD openflags,
 	0
       };
       /* g++ 11.2 workaround: don't use initializer */
-      MEM_EXTENDED_PARAMETER mmap_ext;
+      MEM_EXTENDED_PARAMETER mmap_ext = { 0 };
       mmap_ext.Type = MemExtendedParameterAddressRequirements;
-      mmap_ext.Reserved = 0;
       mmap_ext.Pointer = (PVOID) &mmap_req;
 
       alloc_type |= attached (prot) ? MEM_RESERVE : 0;
@@ -1628,9 +1627,8 @@ fhandler_dev_zero::mmap (caddr_t *addr, size_t len, int prot,
 	    0
 	  };
 	  /* g++ 11.2 workaround: don't use initializer */
-	  MEM_EXTENDED_PARAMETER mmap_ext;
+	  MEM_EXTENDED_PARAMETER mmap_ext = { 0 };
 	  mmap_ext.Type = MemExtendedParameterAddressRequirements;
-	  mmap_ext.Reserved = 0;
 	  mmap_ext.Pointer = (PVOID) &mmap_req;
 
 	  base = VirtualAlloc2 (GetCurrentProcess(), *addr, len, alloc_type,


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-08  8:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08  8:17 [newlib-cygwin] Cygwin: fix initializing MEM_EXTENDED_PARAMETER, take 2 Corinna Vinschen

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).