x86_64: Add missing mask operation to vdso
authorAndi Kleen <ak@suse.de>
Tue, 11 Sep 2007 12:02:09 +0000 (14:02 +0200)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 12 Sep 2007 16:28:06 +0000 (09:28 -0700)
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 <ak@suse.de>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/x86_64/vdso/vclock_gettime.c

index 17f6a00de712eee914f86471270255cfd0516721..5b54cdfb2b07f989c34696ba1ca95c8dcd9f518d 100644 (file)
@@ -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)