Skip to contentSkip to conversation

timespec: normalize off by one errors

PATCH New Thomas Gleixner 1 participant 1 message Nov 24, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 timespec: normalize off by one errors

Linus tree has a fix for set_normalized_timespec (commit 3f39894d1b5c253b10fcb8fbbbcf65a330f6cdc7)

[PATCH] timespec: normalize off by one errors

It would appear that the timespec normalize code has an off by one error. Found in three places. Thanks to Ben for spotting.

It got lost in -mm due to the deinlining of set_normalized_timespec

kernel/time.c +1 -1
Index: linux-2.6.15-rc2-mm1/kernel/time.c
===================================================================
@@ -611,7 +611,7 @@ EXPORT_SYMBOL(mktime);
  */
 void set_normalized_timespec (struct timespec *ts, time_t sec, long nsec)
 {
-	while (nsec > NSEC_PER_SEC) {
+	while (nsec >= NSEC_PER_SEC) {
 		nsec -= NSEC_PER_SEC;
 		++sec;
 	}