[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/47] valgrind/i386: avoid false positives on KVM_SE
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 09/47] valgrind/i386: avoid false positives on KVM_SET_MSRS ioctl |
Date: |
Mon, 15 Dec 2014 17:37:53 +0100 |
From: Christian Borntraeger <address@hidden>
struct kvm_msrs contains padding bytes. Let's use a designated
initializer on the info part to avoid false positives from
valgrind/memcheck. Do the same for generic MSRS, the TSC and
feature control.
We also need to zero out the reserved fields in the entries.
We do this in kvm_msr_entry_set as suggested by Paolo. This
avoids a big memset that a designated initializer on the
full structure would do.
Signed-off-by: Christian Borntraeger <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
target-i386/kvm.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 42f8def..93927bd 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -1152,6 +1152,7 @@ static void kvm_msr_entry_set(struct kvm_msr_entry *entry,
uint32_t index, uint64_t value)
{
entry->index = index;
+ entry->reserved = 0;
entry->data = value;
}
@@ -1170,7 +1171,9 @@ static int kvm_put_tscdeadline_msr(X86CPU *cpu)
kvm_msr_entry_set(&msrs[0], MSR_IA32_TSCDEADLINE, env->tsc_deadline);
- msr_data.info.nmsrs = 1;
+ msr_data.info = (struct kvm_msrs) {
+ .nmsrs = 1,
+ };
return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_MSRS, &msr_data);
}
@@ -1190,7 +1193,11 @@ static int kvm_put_msr_feature_control(X86CPU *cpu)
kvm_msr_entry_set(&msr_data.entry, MSR_IA32_FEATURE_CONTROL,
cpu->env.msr_ia32_feature_control);
- msr_data.info.nmsrs = 1;
+
+ msr_data.info = (struct kvm_msrs) {
+ .nmsrs = 1,
+ };
+
return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_MSRS, &msr_data);
}
@@ -1339,7 +1346,9 @@ static int kvm_put_msrs(X86CPU *cpu, int level)
}
}
- msr_data.info.nmsrs = n;
+ msr_data.info = (struct kvm_msrs) {
+ .nmsrs = n,
+ };
return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_MSRS, &msr_data);
--
1.8.3.1
- [Qemu-devel] [PULL 00/47] Patches for KVM, x86, SCSI, migration fixes (2014-12-15), Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 01/47] Add bootloader name to multiboot implementation, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 03/47] KVM_CAP_IRQFD and KVM_CAP_IRQFD_RESAMPLE checks, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 04/47] vfio: use kvm_resamplefds_enabled(), Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 05/47] valgrind: avoid false positives in KVM_GET_DIRTY_LOG ioctl, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 02/47] target-i386: simplify AES emulation, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 07/47] valgrind/i386: avoid false positives on KVM_SET_PIT ioctl, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 06/47] valgrind/i386: avoid false positives on KVM_SET_CLOCK ioctl, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 08/47] valgrind/i386: avoid false positives on KVM_SET_XCRS ioctl, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 09/47] valgrind/i386: avoid false positives on KVM_SET_MSRS ioctl,
Paolo Bonzini <=
- [Qemu-devel] [PULL 10/47] valgrind/i386: avoid false positives on KVM_GET_MSRS ioctl, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 11/47] valgrind/i386: avoid false positives on KVM_SET_VCPU_EVENTS ioctl, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 12/47] valgrind/s390x: avoid false positives on KVM_SET_FPU ioctl, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 14/47] target-i386: add feature flags for CPUID[EAX=0xd, ECX=1], Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 13/47] coverity/s390x: avoid false positive in kvm_irqchip_add_adapter_route, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 16/47] target-i386: get/set/migrate XSAVES state, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 15/47] target-mips: kvm: do not use get_clock(), Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 18/47] x86: Fuse g_malloc(); memset() into g_malloc0(), Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 17/47] x86: Drop superfluous conditionals around g_free(), Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 19/47] x86: Use g_new() & friends where that makes obvious sense, Paolo Bonzini, 2014/12/15