From: Andi Kleen Date: Tue, 11 Sep 2007 12:02:09 +0000 (+0200) Subject: x86_64: Add missing mask operation to vdso X-Git-Tag: v2.6.23-rc7~61 X-Git-Url: http://git.samba.org/samba.git/?p=sfrench%2Fcifs-2.6.git;a=commitdiff_plain;h=95b08679963c78ce0d675224a6efdb5169f2bf75 x86_64: Add missing mask operation to vdso vdso vgetns() didn't mask the time source offset calculation, which could lead to time problems with 32bit HPET. Add the masking. Thanks to Chuck Ebbert for tracking this down. Signed-off-by: Andi Kleen Cc: Chuck Ebbert Signed-off-by: Linus Torvalds --- diff --git a/arch/x86_64/vdso/vclock_gettime.c b/arch/x86_64/vdso/vclock_gettime.c index 17f6a00de712..5b54cdfb2b07 100644 --- a/arch/x86_64/vdso/vclock_gettime.c +++ b/arch/x86_64/vdso/vclock_gettime.c @@ -34,10 +34,11 @@ static long vdso_fallback_gettime(long clock, struct timespec *ts) static inline long vgetns(void) { + long v; cycles_t (*vread)(void); vread = gtod->clock.vread; - return ((vread() - gtod->clock.cycle_last) * gtod->clock.mult) >> - gtod->clock.shift; + v = (vread() - gtod->clock.cycle_last) & gtod->clock.mask; + return (v * gtod->clock.mult) >> gtod->clock.shift; } static noinline int do_realtime(struct timespec *ts)