All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target/i386/kvm: Silence warning from Valgrind about uninitialized bytes
@ 2019-09-24  7:47 Thomas Huth
  2019-09-24  8:42 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Huth @ 2019-09-24  7:47 UTC (permalink / raw)
  To: qemu-devel, Marcelo Tosatti; +Cc: qemu-trivial, Paolo Bonzini

When I run QEMU with KVM under Valgrind, I currently get this warning:

 Syscall param ioctl(generic) points to uninitialised byte(s)
    at 0x95BA45B: ioctl (in /usr/lib64/libc-2.28.so)
    by 0x429DC3: kvm_ioctl (kvm-all.c:2365)
    by 0x51B249: kvm_arch_get_supported_msr_feature (kvm.c:469)
    by 0x4C2A49: x86_cpu_get_supported_feature_word (cpu.c:3765)
    by 0x4C4116: x86_cpu_expand_features (cpu.c:5065)
    by 0x4C7F8D: x86_cpu_realizefn (cpu.c:5242)
    by 0x5961F3: device_set_realized (qdev.c:835)
    by 0x7038F6: property_set_bool (object.c:2080)
    by 0x707EFE: object_property_set_qobject (qom-qobject.c:26)
    by 0x705814: object_property_set_bool (object.c:1338)
    by 0x498435: pc_new_cpu (pc.c:1549)
    by 0x49C67D: pc_cpus_init (pc.c:1681)
  Address 0x1ffeffee74 is on thread 1's stack
  in frame #2, created by kvm_arch_get_supported_msr_feature (kvm.c:445)

It's harmless, but a little bit annoying, so silence it by properly
initializing the whole structure with zeroes.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 target/i386/kvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 92069099ab..bd92dabea6 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -447,7 +447,7 @@ uint32_t kvm_arch_get_supported_msr_feature(KVMState *s, uint32_t index)
     struct {
         struct kvm_msrs info;
         struct kvm_msr_entry entries[1];
-    } msr_data;
+    } msr_data = {};
     uint32_t ret;
 
     if (kvm_feature_msrs == NULL) { /* Host doesn't support feature MSRs */
-- 
2.18.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] target/i386/kvm: Silence warning from Valgrind about uninitialized bytes
  2019-09-24  7:47 [PATCH] target/i386/kvm: Silence warning from Valgrind about uninitialized bytes Thomas Huth
@ 2019-09-24  8:42 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2019-09-24  8:42 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel, Marcelo Tosatti; +Cc: qemu-trivial

On 24/09/19 09:47, Thomas Huth wrote:
> When I run QEMU with KVM under Valgrind, I currently get this warning:
> 
>  Syscall param ioctl(generic) points to uninitialised byte(s)
>     at 0x95BA45B: ioctl (in /usr/lib64/libc-2.28.so)
>     by 0x429DC3: kvm_ioctl (kvm-all.c:2365)
>     by 0x51B249: kvm_arch_get_supported_msr_feature (kvm.c:469)
>     by 0x4C2A49: x86_cpu_get_supported_feature_word (cpu.c:3765)
>     by 0x4C4116: x86_cpu_expand_features (cpu.c:5065)
>     by 0x4C7F8D: x86_cpu_realizefn (cpu.c:5242)
>     by 0x5961F3: device_set_realized (qdev.c:835)
>     by 0x7038F6: property_set_bool (object.c:2080)
>     by 0x707EFE: object_property_set_qobject (qom-qobject.c:26)
>     by 0x705814: object_property_set_bool (object.c:1338)
>     by 0x498435: pc_new_cpu (pc.c:1549)
>     by 0x49C67D: pc_cpus_init (pc.c:1681)
>   Address 0x1ffeffee74 is on thread 1's stack
>   in frame #2, created by kvm_arch_get_supported_msr_feature (kvm.c:445)
> 
> It's harmless, but a little bit annoying, so silence it by properly
> initializing the whole structure with zeroes.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  target/i386/kvm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index 92069099ab..bd92dabea6 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -447,7 +447,7 @@ uint32_t kvm_arch_get_supported_msr_feature(KVMState *s, uint32_t index)
>      struct {
>          struct kvm_msrs info;
>          struct kvm_msr_entry entries[1];
> -    } msr_data;
> +    } msr_data = {};
>      uint32_t ret;
>  
>      if (kvm_feature_msrs == NULL) { /* Host doesn't support feature MSRs */
> 

Queued, thanks.

Paolo


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-24  8:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-24  7:47 [PATCH] target/i386/kvm: Silence warning from Valgrind about uninitialized bytes Thomas Huth
2019-09-24  8:42 ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.