Skip to content

Commit

Permalink
KVM: SVM: fix error return code in svm_create_vcpu()
Browse files Browse the repository at this point in the history
Fix to return a negative error code from the error handling case
instead of 0 in function svm_create_vcpu(), as done elsewhere in this
function.

Fixes: f4c847a ("KVM: SVM: refactor msr permission bitmap allocation")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Message-Id: <20201117025426.167824-1-chenzhou10@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Chen Zhou authored and Paolo Bonzini committed Nov 17, 2020
1 parent 854c57f commit 054409a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/x86/kvm/svm/svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1309,8 +1309,10 @@ static int svm_create_vcpu(struct kvm_vcpu *vcpu)
svm->avic_is_running = true;

svm->msrpm = svm_vcpu_alloc_msrpm();
if (!svm->msrpm)
if (!svm->msrpm) {
err = -ENOMEM;
goto error_free_vmcb_page;
}

svm_vcpu_init_msrpm(vcpu, svm->msrpm);

Expand Down

0 comments on commit 054409a

Please sign in to comment.