[PATCH] timed parameter validation check fix

Hu, Boris boris.hu@intel.com
Thu Jun 24 12:26:00 GMT 2004


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}

-------------- next part --------------
A non-text attachment was scrubbed...
Name: timed-fix.patch
Type: application/octet-stream
Size: 1406 bytes
Desc: timed-fix.patch
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20040624/34509a01/attachment.obj>


More information about the Libc-alpha mailing list