]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
KVM: fix LAPIC timer period overflow
authorAurelien Jarno <aurelien@aurel32.net>
Fri, 25 Sep 2009 09:09:37 +0000 (11:09 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 12 Oct 2009 19:40:18 +0000 (12:40 -0700)
commit b2d83cfa3fdefe5c6573d443d099a18dc3a93c5f upstream.

Don't overflow when computing the 64-bit period from 32-bit registers.

Fixes sourceforge bug #2826486.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/kvm/lapic.c

index bb6277d5b2c07f2785b2d618461a612d75a27234..b225176b5981b86bd8b11f6391a8674839289fb5 100644 (file)
@@ -567,7 +567,7 @@ static void start_apic_timer(struct kvm_lapic *apic)
 {
        ktime_t now = apic->lapic_timer.timer.base->get_time();
 
-       apic->lapic_timer.period = apic_get_reg(apic, APIC_TMICT) *
+       apic->lapic_timer.period = (u64)apic_get_reg(apic, APIC_TMICT) *
                    APIC_BUS_CYCLE_NS * apic->divide_count;
        atomic_set(&apic->lapic_timer.pending, 0);