public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* KVM: PIT: fix kpit_elapsed division by zero
@ 2009-07-02 23:02 Marcelo Tosatti
  2009-07-06  7:44 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Marcelo Tosatti @ 2009-07-02 23:02 UTC (permalink / raw)
  To: kvm


Fix division by zero triggered by latch count command on uninitialized
counter.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>


diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 14bbaae..8c3ac30 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -104,6 +104,9 @@ static s64 __kpit_elapsed(struct kvm *kvm)
 	ktime_t remaining;
 	struct kvm_kpit_state *ps = &kvm->arch.vpit->pit_state;
 
+	if (!ps->pit_timer.period)
+		return 0;
+
 	/*
 	 * The Counter does not stop when it reaches zero. In
 	 * Modes 0, 1, 4, and 5 the Counter ``wraps around'' to

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: KVM: PIT: fix kpit_elapsed division by zero
  2009-07-02 23:02 KVM: PIT: fix kpit_elapsed division by zero Marcelo Tosatti
@ 2009-07-06  7:44 ` Avi Kivity
  0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2009-07-06  7:44 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm

On 07/03/2009 02:02 AM, Marcelo Tosatti wrote:
> Fix division by zero triggered by latch count command on uninitialized
> counter.
>    

Applied, thanks.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-07-06  7:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-02 23:02 KVM: PIT: fix kpit_elapsed division by zero Marcelo Tosatti
2009-07-06  7:44 ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox