Re: [PATCH] KVM: SVM: Fix potential memory leak in svm_cpu_init()

From: linmiaohe
Date: Thu Jan 02 2020 - 21:20:40 EST

Vitaly writes:
>> From: Miaohe Lin <linmiaohe@xxxxxxxxxx>
>> if (svm_sev_enabled()) {
>> r = -ENOMEM;
>Not your fault but this assignment to 'r' seem to be redundant: it is already set to '-ENOMEM' above, but this is also not perfect as ...
>> @@ -1020,14 +1020,16 @@ static int svm_cpu_init(int cpu)
>> sizeof(void *),
>> return r;
>... '-ENOMEM' is actually the only possible outcome here. In case you'll be re-submitting, I'd suggest we drop 'r' entirely and just reture -ENOMEM here.

The var r is really unnecessary and we should clean it up. Thanks for your good suggest. I would send a patch v2 soon.

>Anyways, your patch seems to be correct, so:
>Reviewed-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>

Thanks for your review.