Re: [PATCH 3/3] i386/kvm: initialize struct at full before ioctl call

Paolo Bonzini
2019-07-31T13:03:05Z

On 31/07/19 14:43, Christian Borntraeger wrote:
>>>>>> if (has_xsave) {
>>>>>> env->xsave_buf = qemu_memalign(4096, sizeof(struct kvm_xsave));
>>>>>> + memset(env->xsave_buf, 0, sizeof(struct kvm_xsave));
> This is memsetting 4k?
> Yet another variant would be to use the RUNNING_ON_VALGRIND macro from
> valgrind/valgrind.h to only memset for valgrind. But just using MAKE_MEM_DEFINED
> from memcheck.h is simpler.
>

Yes, it's 4k but only at initialization time and I actually prefer not
to have potentially uninitialized host data in there.

Paolo