From b07fee24dcefbeed5bdacb7e1b74e8423a2c20be Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Tue, 15 May 2007 10:17:58 +0200 Subject: [PATCH] [PATCH] x86_64 : Fix vgettimeofday() vgettimeofday() may return some bad timeval values, (tv_usec = 1000000), because of a wrong compare. Signed-off-by: Eric Dumazet Signed-off-by: Chris Wright --- arch/x86_64/kernel/vsyscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86_64/kernel/vsyscall.c b/arch/x86_64/kernel/vsyscall.c index b43c698cf7d3..fc9f0429e3ff 100644 --- a/arch/x86_64/kernel/vsyscall.c +++ b/arch/x86_64/kernel/vsyscall.c @@ -132,7 +132,7 @@ static __always_inline void do_vgettimeofday(struct timeval * tv) /* convert to usecs and add to timespec: */ tv->tv_usec += nsec_delta / NSEC_PER_USEC; - while (tv->tv_usec > USEC_PER_SEC) { + while (tv->tv_usec >= USEC_PER_SEC) { tv->tv_sec += 1; tv->tv_usec -= USEC_PER_SEC; } -- 2.39.5