From: Marcelo Tosatti <mtosatti@xxxxxxxxxx> Reported-by: Gleb Natapov <gleb@xxxxxxxxxx> Signed-off-by: Marcelo Tosatti <mtosatti@xxxxxxxxxx> diff --git a/hw/apic.c b/hw/apic.c index 1dd94b1..04ff36a 100644 --- a/hw/apic.c +++ b/hw/apic.c @@ -955,6 +955,10 @@ void kvm_load_lapic(CPUState *env) #ifdef KVM_CAP_IRQCHIP APICState *s = DO_UPCAST(APICState, busdev.qdev, env->apic_state); + if (!s) { + return; + } + if (kvm_enabled() && kvm_irqchip_in_kernel()) { kvm_kernel_lapic_load_from_user(s); } @@ -966,6 +970,10 @@ void kvm_save_lapic(CPUState *env) #ifdef KVM_CAP_IRQCHIP APICState *s = DO_UPCAST(APICState, busdev.qdev, env->apic_state); + if (!s) { + return; + } + if (kvm_enabled() && kvm_irqchip_in_kernel()) { kvm_kernel_lapic_save_to_user(s); } -- To unsubscribe from this list: send the line "unsubscribe kvm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html