Set the default value of nr_lvt_entries to KVM_APIC_MAX_NR_LVT_ENTRIES-1 to address the cases when KVM_X86_SETUP_MCE is not called. Fixes: 4b903561ec49 ("KVM: x86: Add Corrected Machine Check Interrupt (CMCI) emulation to lapic.") Signed-off-by: Jue Wang <juew@xxxxxxxxxx> --- arch/x86/kvm/lapic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 8537b66cc646..257366b8e3ae 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -2524,6 +2524,7 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu, int timer_advance_ns) vcpu->arch.apic = apic; + apic->nr_lvt_entries = KVM_APIC_MAX_NR_LVT_ENTRIES - 1; apic->regs = (void *)get_zeroed_page(GFP_KERNEL_ACCOUNT); if (!apic->regs) { printk(KERN_ERR "malloc apic regs error for vcpu %x\n", -- 2.37.0.rc0.161.g10f37bed90-goog