From 600b4be4d9439aa0f107cd63760d9fc121432717 Mon Sep 17 00:00:00 2001 From: Mike Crowe Date: Mon, 24 Jun 2019 12:39:02 +0000 Subject: nptl: pthread_rwlock: Move timeout validation into _full functions As recommended by the comments in the implementations of pthread_rwlock_timedrdlock and pthread_rwlock_timedwrlock, let's move the timeout validity checks into the corresponding pthread_rwlock_rdlock_full and pthread_rwlock_wrlock_full functions. Since these functions may be called with abstime == NULL, an extra check for that is necessary too. * nptl/pthread_rwlock_common.c (__pthread_rwlock_rdlock_full): Check validity of abstime parameter. (__pthread_rwlock_rwlock_full): Likewise. * nptl/pthread_rwlock_timedrdlock.c * (pthread_rwlock_timedrdlock): Remove check for validity of abstime parameter. * nptl/pthread_rwlock_timedwrlock.c * (pthread_rwlock_timedwrlock): Likewise. Reviewed-by: Adhemerval Zanella --- nptl/pthread_rwlock_timedwrlock.c | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'nptl/pthread_rwlock_timedwrlock.c') diff --git a/nptl/pthread_rwlock_timedwrlock.c b/nptl/pthread_rwlock_timedwrlock.c index 3c92e44830..f0b745df02 100644 --- a/nptl/pthread_rwlock_timedwrlock.c +++ b/nptl/pthread_rwlock_timedwrlock.c @@ -23,15 +23,5 @@ int pthread_rwlock_timedwrlock (pthread_rwlock_t *rwlock, const struct timespec *abstime) { - /* Make sure the passed in timeout value is valid. Note that the previous - implementation assumed that this check *must* not be performed if there - would in fact be no blocking; however, POSIX only requires that "the - validity of the abstime parameter need not be checked if the lock can be - immediately acquired" (i.e., we need not but may check it). */ - /* ??? Just move this to __pthread_rwlock_wrlock_full? */ - if (__glibc_unlikely (abstime->tv_nsec >= 1000000000 - || abstime->tv_nsec < 0)) - return EINVAL; - return __pthread_rwlock_wrlock_full (rwlock, abstime); } -- cgit v1.2.3-70-g09d2