kern/149980: [patch] negative value integer to nanosleep(2)
should fail with EINVAL
vwe at FreeBSD.org
vwe at FreeBSD.org
Sun Aug 29 20:03:24 UTC 2010
Old Synopsis: [PATCH] negative value integer to nanosleep(2) should fail with EINVAL
New Synopsis: [patch] negative value integer to nanosleep(2) should fail with EINVAL
State-Changed-From-To: open->analyzed
State-Changed-By: vwe
State-Changed-When: Sun Aug 29 20:00:22 UTC 2010
State-Changed-Why:
double checked that and it's looking reasonable
I think the checks for 'tv_nsec < 0' and 'tv_sec < 0' can be made in one go,
but IMO it should not make a difference (assembler wise):
Index: sys/kern/kern_time.c
===================================================================
--- sys/kern/kern_time.c (revision 211522)
+++ sys/kern/kern_time.c (working copy)
@@ -362,9 +362,9 @@
struct timeval tv;
int error;
- if (rqt->tv_nsec < 0 || rqt->tv_nsec >= 1000000000)
+ if (rqt->tv_nsec < 0 || rqt->tv_nsec >= 1000000000 || rqt->tv_sec < 0)
return (EINVAL);
- if (rqt->tv_sec < 0 || (rqt->tv_sec == 0 && rqt->tv_nsec == 0))
+ if (rqt->tv_sec == 0 && rqt->tv_nsec == 0)
return (0);
getnanouptime(&ts);
timespecadd(&ts, rqt);
http://www.freebsd.org/cgi/query-pr.cgi?pr=149980
More information about the freebsd-bugs
mailing list