Skip to contentSkip to conversation

KVM: PIT: fix kpit_elapsed division by zero

PATCH Applied Marcelo Tosatti 2 participants 2 messages Jul 2, 2009 – Jul 6, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

arch/x86/kvm/i8254.c +3 -0
index 14bbaae..8c3ac30 100644
@@ -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
Applied
#1 lore raw
Quoted 3 lines · Marcelo Tosatti

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

Applied, thanks.

Signature · 1 line
error compiling committee.c: too many arguments to function