RE: [BUG] settimeofday(2) succeeds for microsecond value more than USEC_PER_SEC and for negative value

From: Aniruddha M Marathe (aniruddha.marathe@wipro.com)
Date: Sat Apr 12 2003 - 05:43:33 EST


|Aniruddha M Marathe wrote:
|> Even then, I think, we can modify the settimeofday code to
|check -1 and USEC_PER_SEC
|> Conditions, can't we?
|>

George wrote:

|Uh, sure. This is the test I prefer:
|
| if( (unsigned long)tv->usec > USEC_PER_SEC)
| return EINVAL;
|
|
|This change should go in do_sys_settimeofday() in kernel/time.c. It
|will fix both settimeofday and clock_settime(CLOCK_REALTIME,... And
|also fixes it in all archs.
|
|-g

How about
If( (unsigned long)tv->usec >= USEC_PER_SEC)
        return EINVAL;

Even if tv_usec value is 10^6, it should give EINVAL.
Man page must also be updated
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Apr 15 2003 - 22:00:26 EST