Skip to content

Commit 23520b2

Browse files
MiaoheLinbonzini
authored andcommitted
KVM: apic: avoid calculating pending eoi from an uninitialized val
When pv_eoi_get_user() fails, 'val' may remain uninitialized and the return value of pv_eoi_get_pending() becomes random. Fix the issue by initializing the variable. Reviewed-by: Vitaly Kuznetsov <[email protected]> Signed-off-by: Miaohe Lin <[email protected]> Cc: [email protected] Signed-off-by: Paolo Bonzini <[email protected]>
1 parent a444326 commit 23520b2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arch/x86/kvm/lapic.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,9 +627,11 @@ static inline bool pv_eoi_enabled(struct kvm_vcpu *vcpu)
627627
static bool pv_eoi_get_pending(struct kvm_vcpu *vcpu)
628628
{
629629
u8 val;
630-
if (pv_eoi_get_user(vcpu, &val) < 0)
630+
if (pv_eoi_get_user(vcpu, &val) < 0) {
631631
printk(KERN_WARNING "Can't read EOI MSR value: 0x%llx\n",
632632
(unsigned long long)vcpu->arch.pv_eoi.msr_val);
633+
return false;
634+
}
633635
return val & 0x1;
634636
}
635637

0 commit comments

Comments
 (0)