This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] timed parameter validation check fix


Hi,

2004-06-24  Boris Hu <boris.hu@intel.com>

	* nptl/sysdeps/pthread/pthread_rwlock_timedrdlock.c:	Add
timeout validation check.
	* nptl/sysdeps/pthread/pthread_rwlock_timedwrlock.c:
Likewise.

diff -urN src.orig/nptl/sysdeps/pthread/pthread_rwlock_timedrdlock.c
src/nptl/sysdeps/pthread/pthread_rwlock_timedrdlock.c
--- src.orig/nptl/sysdeps/pthread/pthread_rwlock_timedrdlock.c
2004-06-24 19:11:07.000000000 +0800
+++ src/nptl/sysdeps/pthread/pthread_rwlock_timedrdlock.c
2004-06-24 19:22:40.000000000 +0800
@@ -70,7 +70,8 @@
 	 performed if we would not block at all simply moving the test
 	 to the front is no option.  Replicating all the code is
 	 costly while this test is not.  */
-      if (__builtin_expect (abstime->tv_nsec >= 1000000000, 0))
+      if (__builtin_expect (abstime->tv_nsec >= 1000000000
+                            || abstime->tv_sec < 0, 0))
 	{
 	  result = EINVAL;
 	  break;
diff -urN src.orig/nptl/sysdeps/pthread/pthread_rwlock_timedwrlock.c
src/nptl/sysdeps/pthread/pthread_rwlock_timedwrlock.c
--- src.orig/nptl/sysdeps/pthread/pthread_rwlock_timedwrlock.c
2004-06-24 19:11:07.000000000 +0800
+++ src/nptl/sysdeps/pthread/pthread_rwlock_timedwrlock.c
2004-06-24 19:23:38.000000000 +0800
@@ -61,7 +61,8 @@
 	 performed if we would not block at all simply moving the test
 	 to the front is no option.  Replicating all the code is
 	 costly while this test is not.  */
-      if (abstime->tv_nsec >= 1000000000)
+      if (__builtin_expect (abstime->tv_nsec >= 1000000000
+                            || abstime->tv_sec < 0, 0))
 	{
 	  result = EINVAL;
 	  break;

Thanks.

Boris Hu (Hu Jiangtao)
Intel China Software Center
86-021-5257-4545#1277
iNET: 8-752-1277
************************************
There are my thoughts, not?my employer's.
************************************
"gpg --recv-keys --keyserver wwwkeys.pgp.net 0FD7685F"
{0FD7685F:CFD6 6F5C A2CB 7881 725B  CEA0 956F 9F14 0FD7 685F}

Attachment: timed-fix.patch
Description: timed-fix.patch


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]