diff mbox

KVM: fix LAPIC timer period overflow

Message ID 20090925090937.GA30138@hall.aurel32.net (mailing list archive)
State New, archived
Headers show

Commit Message

Aurelien Jarno Sept. 25, 2009, 9:09 a.m. UTC
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>
---
 arch/x86/kvm/lapic.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Marcelo Tosatti Sept. 28, 2009, 4:33 p.m. UTC | #1
On Fri, Sep 25, 2009 at 11:09:37AM +0200, Aurelien Jarno wrote:
> 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>
> ---
>  arch/x86/kvm/lapic.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index 9c8f901..3ca7767 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -658,7 +658,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);

Applied, thanks.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 9c8f901..3ca7767 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -658,7 +658,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);