about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-12-01 21:39:30 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-12-01 21:42:12 +0100
commitfc493bc9e6fe8ecdd00f79b9a8a3d4675137a602 (patch)
tree75ea15d71527fceb2b1511620420960fbbe439c1
parent6310e6be9b7c322d56a45729b3ebcd22e26dd0c2 (diff)
downloadglibc-fc493bc9e6fe8ecdd00f79b9a8a3d4675137a602.tar.gz
glibc-fc493bc9e6fe8ecdd00f79b9a8a3d4675137a602.tar.xz
glibc-fc493bc9e6fe8ecdd00f79b9a8a3d4675137a602.zip
htl: Fix comparing attr with default values
Fortunately we were previously only missing an optimization.

Thanks dcb <dcb314@hotmail.com> for the report

	[BZ #23032]
	* sysdeps/htl/pt-barrier-init.c (pthread_barrier_init): Fix comparing
	attr with __pthread_default_barrierattr.
	* sysdeps/htl/pt-cond-init.c (__pthread_cond_init): Fix comparing
	attr with __pthread_default_condattr.
	* sysdeps/htl/pt-mutex-init.c (_pthread_mutex_init): Fix comparing
	attr with __pthread_default_mutexattr.
	* sysdeps/htl/pt-rwlock-init.c (_pthread_rwlock_init): Fix comparing
	attr with __pthread_default_rwlockattr.
-rw-r--r--ChangeLog12
-rw-r--r--sysdeps/htl/pt-barrier-init.c2
-rw-r--r--sysdeps/htl/pt-cond-init.c2
-rw-r--r--sysdeps/htl/pt-mutex-init.c2
-rw-r--r--sysdeps/htl/pt-rwlock-init.c2
5 files changed, 16 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 411116acbe..e00d691d90 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2018-12-01  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	[BZ #23032]
+	* sysdeps/htl/pt-barrier-init.c (pthread_barrier_init): Fix comparing
+	attr with __pthread_default_barrierattr.
+	* sysdeps/htl/pt-cond-init.c (__pthread_cond_init): Fix comparing
+	attr with __pthread_default_condattr.
+	* sysdeps/htl/pt-mutex-init.c (_pthread_mutex_init): Fix comparing
+	attr with __pthread_default_mutexattr.
+	* sysdeps/htl/pt-rwlock-init.c (_pthread_rwlock_init): Fix comparing
+	attr with __pthread_default_rwlockattr.
+
 2018-12-01  Kemi Wang  <kemi.wang@intel.com>
 
 	* manual/tunables.texi (POSIX Thread Tunables): New node.
diff --git a/sysdeps/htl/pt-barrier-init.c b/sysdeps/htl/pt-barrier-init.c
index 7d46624fbe..f94dcca3dc 100644
--- a/sysdeps/htl/pt-barrier-init.c
+++ b/sysdeps/htl/pt-barrier-init.c
@@ -36,7 +36,7 @@ pthread_barrier_init (pthread_barrier_t *barrier,
   barrier->__count = count;
 
   if (attr == NULL
-      || memcmp (attr, &__pthread_default_barrierattr, sizeof (*attr) == 0))
+      || memcmp (attr, &__pthread_default_barrierattr, sizeof (*attr)) == 0)
     /* Use the default attributes.  */
     return 0;
 
diff --git a/sysdeps/htl/pt-cond-init.c b/sysdeps/htl/pt-cond-init.c
index 4c112e2789..4ae8859b82 100644
--- a/sysdeps/htl/pt-cond-init.c
+++ b/sysdeps/htl/pt-cond-init.c
@@ -28,7 +28,7 @@ __pthread_cond_init (pthread_cond_t *cond, const pthread_condattr_t * attr)
   *cond = (pthread_cond_t) __PTHREAD_COND_INITIALIZER;
 
   if (attr == NULL
-      || memcmp (attr, &__pthread_default_condattr, sizeof (*attr) == 0))
+      || memcmp (attr, &__pthread_default_condattr, sizeof (*attr)) == 0)
     /* Use the default attributes.  */
     return 0;
 
diff --git a/sysdeps/htl/pt-mutex-init.c b/sysdeps/htl/pt-mutex-init.c
index 664fd607c1..813b976e62 100644
--- a/sysdeps/htl/pt-mutex-init.c
+++ b/sysdeps/htl/pt-mutex-init.c
@@ -29,7 +29,7 @@ _pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
   *mutex = (pthread_mutex_t) __PTHREAD_MUTEX_INITIALIZER;
 
   if (attr == NULL
-      || memcmp (attr, &__pthread_default_mutexattr, sizeof (*attr) == 0))
+      || memcmp (attr, &__pthread_default_mutexattr, sizeof (*attr)) == 0)
     /* The default attributes.  */
     return 0;
 
diff --git a/sysdeps/htl/pt-rwlock-init.c b/sysdeps/htl/pt-rwlock-init.c
index 527b0ec62f..41d6df5d38 100644
--- a/sysdeps/htl/pt-rwlock-init.c
+++ b/sysdeps/htl/pt-rwlock-init.c
@@ -27,7 +27,7 @@ _pthread_rwlock_init (pthread_rwlock_t *rwlock,
   *rwlock = (pthread_rwlock_t) __PTHREAD_RWLOCK_INITIALIZER;
 
   if (attr == NULL
-      || memcmp (attr, &__pthread_default_rwlockattr, sizeof (*attr) == 0))
+      || memcmp (attr, &__pthread_default_rwlockattr, sizeof (*attr)) == 0)
     /* Use the default attributes.  */
     return 0;