aboutsummaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorAndrey Shinkevich <andrey.shinkevich@virtuozzo.com>2019-07-30 19:01:38 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2019-08-20 17:26:19 +0200
commit1f670a95b370651bcf3721aa0941d57e185478cf (patch)
treea3b79c4937d3df541fc6dc0a43607f1361ba86c5 /target
parentf673174e3f62096f45b874fbe1cd469127d9c21c (diff)
i386/kvm: initialize struct at full before ioctl call
Not the whole structure is initialized before passing it to the KVM. Reduce the number of Valgrind reports. Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com> Message-Id: <1564502498-805893-4-git-send-email-andrey.shinkevich@virtuozzo.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target')
-rw-r--r--target/i386/kvm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 608bb44270..615dfce909 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -193,6 +193,7 @@ static int kvm_get_tsc(CPUState *cs)
return 0;
}
+ memset(&msr_data, 0, sizeof(msr_data));
msr_data.info.nmsrs = 1;
msr_data.entries[0].index = MSR_IA32_TSC;
env->tsc_valid = !runstate_is_running();
@@ -1709,6 +1710,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
if (has_xsave) {
env->xsave_buf = qemu_memalign(4096, sizeof(struct kvm_xsave));
+ memset(env->xsave_buf, 0, sizeof(struct kvm_xsave));
}
max_nested_state_len = kvm_max_nested_state_length();
@@ -3491,6 +3493,7 @@ static int kvm_put_debugregs(X86CPU *cpu)
return 0;
}
+ memset(&dbgregs, 0, sizeof(dbgregs));
for (i = 0; i < 4; i++) {
dbgregs.db[i] = env->dr[i];
}