Re: [PATCH] KVM: SVM: Remove a useless zeroing of allocated memory

From: Sean Christopherson
Date: Tue Mar 12 2024 - 14:41:16 EST


On Sat, Mar 09, 2024, Christophe JAILLET wrote:
> 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@xxxxxxxxxx>
> ---
> 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.

Not zeroing should be totally fine, the array is only used to hold kernel pointers,
if KVM leaks that state and/or accesses uninitialized data, we have bigger problems :-)