diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2009-09-14 23:37:40 +0200 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2009-09-15 11:11:32 +0200 |
| commit | f7ada8bfd366090d64be430028db8fa4682b3f5f (patch) | |
| tree | 93c9fb0d9330694005b75fd9f5b55b19b7bcb8c5 /include/linux | |
| parent | 744e53260765ea1171f46ba12884f25e344084c2 (diff) | |
| download | lwn-f7ada8bfd366090d64be430028db8fa4682b3f5f.tar.gz lwn-f7ada8bfd366090d64be430028db8fa4682b3f5f.zip | |
time: Prevent 32 bit overflow with set_normalized_timespec()
set_normalized_timespec() nsec argument is of type long. The recent
timekeeping changes of ktime_get_ts() feed
ts->tv_nsec + tomono.tv_nsec + nsecs
to set_normalized_timespec(). On 32 bit machines that sum can be
larger than (1 << 31) and therefor result in a negative value which
screws up the result completely.
Make the nsec argument of set_normalized_timespec() s64 to fix the
problem at hand. This also prevents similar problems for future users
of set_normalized_timespec().
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Carsten Emde <carsten.emde@osadl.org>
LKML-Reference: <new-submission>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: John Stultz <johnstul@us.ibm.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/time.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/time.h b/include/linux/time.h index 89cf57bc0c6d..2c4acaaa7ea1 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -75,7 +75,7 @@ extern unsigned long mktime(const unsigned int year, const unsigned int mon, const unsigned int day, const unsigned int hour, const unsigned int min, const unsigned int sec); -extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec); +extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec); extern struct timespec timespec_add_safe(const struct timespec lhs, const struct timespec rhs); |
