From: mlarkin Date: Wed, 28 Jun 2017 07:10:02 +0000 (+0000) Subject: fix potential use of uninitialized variable, noticed by jsg@. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2898529bf7c8fafcaf9261798daf8d0987b12c32;p=openbsd fix potential use of uninitialized variable, noticed by jsg@. --- diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c index a1c7b1a4e89..c0495ff2f09 100644 --- a/sys/arch/amd64/amd64/vmm.c +++ b/sys/arch/amd64/amd64/vmm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm.c,v 1.154 2017/06/20 06:25:01 mlarkin Exp $ */ +/* $OpenBSD: vmm.c,v 1.155 2017/06/28 07:10:02 mlarkin Exp $ */ /* * Copyright (c) 2014 Mike Larkin * @@ -5673,6 +5673,12 @@ vcpu_run_svm(struct vcpu *vcpu, struct vm_run_params *vrp) vmcb->v_tlb_control = SVM_TLB_CONTROL_FLUSH_NONE; svm_set_clean(vcpu, SVM_CLEANBITS_ALL); + /* Record the exit reason on successful exit */ + if (ret == 0) { + exit_reason = vmcb->v_exitcode; + vcpu->vc_gueststate.vg_exit_reason = exit_reason; + } + if (ret || exit_reason != SVM_VMEXIT_INTR) { KERNEL_LOCK(); locked = 1; @@ -5683,9 +5689,6 @@ vcpu_run_svm(struct vcpu *vcpu, struct vm_run_params *vrp) if (ret == 0) { resume = 1; - exit_reason = vmcb->v_exitcode; - vcpu->vc_gueststate.vg_exit_reason = exit_reason; - vcpu->vc_gueststate.vg_rflags = vmcb->v_rflags; /*