aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatsy Franklin <pfrankli@redhat.com>2018-06-26 10:35:03 -0400
committerPatsy Franklin <pfrankli@redhat.com>2018-06-26 14:26:01 -0400
commit05598a0907cad1350962e89b781215209a785d92 (patch)
tree644aa749e5a587a157945db9f92d1ad14daf603d
parent06ab719d30b01da401150068054d3b8ea93dd12f (diff)
downloadglibc-05598a0907cad1350962e89b781215209a785d92.zip
glibc-05598a0907cad1350962e89b781215209a785d92.tar.gz
glibc-05598a0907cad1350962e89b781215209a785d92.tar.bz2
In sem_open.c, pad was not initialized when __HAVE_64B_ATOMICS was
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>
-rw-r--r--ChangeLog5
-rw-r--r--nptl/sem_open.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 2eeeabf..9cc8d65 100644
--- 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]
diff --git a/nptl/sem_open.c b/nptl/sem_open.c
index 1d7f142..c5389f6 100644
--- a/nptl/sem_open.c
+++ b/nptl/sem_open.c
@@ -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;