lkml.org 
[lkml]   [2005]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH -mm] timespec: normalize off by one errors
From
Date
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.
Signed-off-by: George Anzinger<george@mvista.com>


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

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>


Index: linux-2.6.15-rc2-mm1/kernel/time.c
===================================================================
--- linux-2.6.15-rc2-mm1.orig/kernel/time.c
+++ 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;
}

-
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/

\
 
 \ /
  Last update: 2005-11-24 16:02    [W:0.023 / U:0.764 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site