Skip to contentSkip to conversation

KVM: SVM: Fix potential memory leak in svm_cpu_init()

PATCH linmiaohe 1 participant 1 message Jan 3, 2020 KVM

lore
Share & tools
lore

linmiaohe

author
#0 lore raw
Quoted 11 lines · Vitaly

Review

Quoted 3 lines

From: Miaohe Lin <[email protected]>

(quoted diff) +0 -0
 	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 ...

Review static int svm_cpu_init(int cpu) · line 1021

Quoted 3 lines
(quoted diff) +0 -0
@@ -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.

Quoted 4 lines

Anyways, your patch seems to be correct, so:

Thanks for your review.