Re: [PATCH] KVM: SVM: Fix "error" isn't initialized

From: linmiaohe
Date: Tue Nov 26 2019 - 22:31:15 EST



> From: Haiwei Li <lihaiwei@xxxxxxxxxxx>
> Subject: [PATCH] initialize 'error'
>
> There are a bunch of error paths were "error" isn't initialized.
Hi,
In case error case, sev_guest_df_flush() do not set the error.
Can you set the value of error to reflect what error happened
in sev_guest_df_flush()?
The current fix may looks confused when print "DF_FLUSH failed" with
error = 0.
Thanks.

PS: This is just my personal point.
>
> Signed-off-by: Haiwei Li <lihaiwei@xxxxxxxxxxx>
> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
>--- a/arch/x86/kvm/svm.c
>+++ b/arch/x86/kvm/svm.c
>@@ -6294,7 +6294,8 @@ static int enable_smi_window(struct kvm_vcpu *vcpu)
>
> static int sev_flush_asids(void)
> {
>- int ret, error;
>+ int ret;
>+ int error = 0;
>
> /*
> * DEACTIVATE will clear the WBINVD indicator causing DF_FLUSH to fail,