[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <c7619a3d3cbb36463531a7c73ccbde9db587986c.1710004509.git.christophe.jaillet@wanadoo.fr>
Date: Sat, 9 Mar 2024 18:15:45 +0100
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>
Cc: linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
kvm@...r.kernel.org
Subject: [PATCH] KVM: SVM: Remove a useless zeroing of allocated memory
Depending of the memory size needed, we clear or not the allocated memory.
This is not consistent.
So remove the zeroing of the memory in the __vmalloc() case.
Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
This is just a guess.
I don't know this code at all, but because of KVM, it is maybe safer to
clear the memory in both cases?
So, maybe it is better to use kzalloc() in the other path.
---
arch/x86/kvm/svm/sev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
index 722186601c03..afd9485bef5a 100644
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@ -434,7 +434,7 @@ static struct page **sev_pin_memory(struct kvm *kvm, unsigned long uaddr,
/* Avoid using vmalloc for smaller buffers. */
size = npages * sizeof(struct page *);
if (size > PAGE_SIZE)
- pages = __vmalloc(size, GFP_KERNEL_ACCOUNT | __GFP_ZERO);
+ pages = __vmalloc(size, GFP_KERNEL_ACCOUNT);
else
pages = kmalloc(size, GFP_KERNEL_ACCOUNT);
--
2.44.0
Powered by blists - more mailing lists