]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
In sem_open.c, pad was not initialized when __HAVE_64B_ATOMICS was
authorPatsy Franklin <pfrankli@redhat.com>
Tue, 26 Jun 2018 14:35:03 +0000 (10:35 -0400)
committerPatsy Franklin <pfrankli@redhat.com>
Tue, 26 Jun 2018 18:26:01 +0000 (14:26 -0400)
true.  On some arches this caused valgrind to warn about uninitialized
bytes when the struct was written to the file system.

This patch moves the initialization of pad outside of the
conditional.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
ChangeLog
nptl/sem_open.c

index 2eeeabf2ad04a87297021e1cbea519e8766d8215..9cc8d65ca846f6e54e29373d8a2ad90b9110062d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-06-26  Patsy Franklin  <pfrankli@redhat.com>
+
+       * nptl/sem_open.c [!__HAVE_64B_ATOMICS] (sem_open): Don't update pad.
+       (sem_open): Set sem.newsem.pad to zero for valgrind.
+
 2018-06-26  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
        [BZ #20251]
index 1d7f142134ec65e18f43f12746c2b00675688913..c5389f6873e0cd351a1a4f5cfd2903e6aa5ad5e7 100644 (file)
@@ -215,10 +215,11 @@ sem_open (const char *name, int oflag, ...)
       sem.newsem.data = value;
 #else
       sem.newsem.value = value << SEM_VALUE_SHIFT;
-      /* pad is used as a mutex on pre-v9 sparc and ignored otherwise.  */
-      sem.newsem.pad = 0;
       sem.newsem.nwaiters = 0;
 #endif
+      /* pad is used as a mutex on pre-v9 sparc and ignored otherwise.  */
+      sem.newsem.pad = 0;
+
       /* This always is a shared semaphore.  */
       sem.newsem.private = FUTEX_SHARED;