Date: Sun, 29 Aug 2010 20:03:24 GMT From: vwe@FreeBSD.org To: gcooper@FreeBSD.org, vwe@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: kern/149980: [patch] negative value integer to nanosleep(2) should fail with EINVAL Message-ID: <201008292003.o7TK3OZl046138@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008292003.o7TK3OZl046138>