Skip to content

Commit 4710e4f

Browse files
tititiou36sean-jc
authored andcommitted
KVM: SVM: Remove a useless zeroing of allocated memory
Remove KVM's unnecessary zeroing of memory when allocating the pages array in sev_pin_memory() via __vmalloc(), as the array is only used to hold kernel pointers. The kmalloc() path for "small" regions doesn't zero the array, and if KVM leaks state and/or accesses uninitialized data, then the kernel has bigger problems. Signed-off-by: Christophe JAILLET <[email protected]> Link: https://lore.kernel.org/r/c7619a3d3cbb36463531a7c73ccbde9db587986c.1710004509.git.christophe.jaillet@wanadoo.fr [sean: massage changelog] Signed-off-by: Sean Christopherson <[email protected]>
1 parent fec50db commit 4710e4f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kvm/svm/sev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ static struct page **sev_pin_memory(struct kvm *kvm, unsigned long uaddr,
434434
/* Avoid using vmalloc for smaller buffers. */
435435
size = npages * sizeof(struct page *);
436436
if (size > PAGE_SIZE)
437-
pages = __vmalloc(size, GFP_KERNEL_ACCOUNT | __GFP_ZERO);
437+
pages = __vmalloc(size, GFP_KERNEL_ACCOUNT);
438438
else
439439
pages = kmalloc(size, GFP_KERNEL_ACCOUNT);
440440

0 commit comments

Comments
 (0)