Patchwork [01/10] Set cpuid definition to 0 before initializing it

login
register
mail settings
Submitter Marcelo Tosatti
Date Oct. 19, 2010, 10:40 a.m.
Message ID <fd59b1f8873cce8d8ff339a1312e27a1fea5559e.1287484836.git.mtosatti@redhat.com>
Download mbox | patch
Permalink /patch/68322/
State New
Headers show

Comments

Marcelo Tosatti - Oct. 19, 2010, 10:40 a.m.
From: Joerg Roedel <joerg.roedel@amd.com>

This patch cleans the (stack-allocated) cpuid definition to
0 before actually initializing it.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
---
 target-i386/cpuid.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Patch

diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
index 04ba8d5..3fcf78f 100644
--- a/target-i386/cpuid.c
+++ b/target-i386/cpuid.c
@@ -788,6 +788,8 @@  int cpu_x86_register (CPUX86State *env, const char *cpu_model)
 {
     x86_def_t def1, *def = &def1;
 
+    memset(def, 0, sizeof(*def));
+
     if (cpu_x86_find_by_name(def, cpu_model) < 0)
         return -1;
     if (def->vendor1) {