linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: SVM: fix error return code in svm_create_vcpu()
@ 2020-11-17  2:54 Chen Zhou
  2020-11-17  7:40 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Zhou @ 2020-11-17  2:54 UTC (permalink / raw)
  To: pbonzini, rkrcmar, tglx, mingo; +Cc: hpa, x86, kvm, linux-kernel, chenzhou10

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: f4c847a95654 ("KVM: SVM: refactor msr permission bitmap allocation")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
---
 arch/x86/kvm/svm/svm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 1e81cfebd491..79b3a564f1c9 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -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);
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] KVM: SVM: fix error return code in svm_create_vcpu()
  2020-11-17  2:54 [PATCH] KVM: SVM: fix error return code in svm_create_vcpu() Chen Zhou
@ 2020-11-17  7:40 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2020-11-17  7:40 UTC (permalink / raw)
  To: Chen Zhou, rkrcmar, tglx, mingo; +Cc: hpa, x86, kvm, linux-kernel

On 17/11/20 03:54, Chen Zhou wrote:
> 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: f4c847a95654 ("KVM: SVM: refactor msr permission bitmap allocation")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
> ---
>   arch/x86/kvm/svm/svm.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index 1e81cfebd491..79b3a564f1c9 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -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);
>   
> 

Queued, thanks.

Paolo


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-17  7:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17  2:54 [PATCH] KVM: SVM: fix error return code in svm_create_vcpu() Chen Zhou
2020-11-17  7:40 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).