summaryrefslogtreecommitdiffstats
path: root/target-i386
diff options
context:
space:
mode:
authorMarkus Armbruster2011-11-08 15:36:50 +0100
committerStefan Hajnoczi2011-11-10 13:29:50 +0100
commit04c5b17a74c9d6c309181079f8949665b43b0164 (patch)
tree787909f87c1fdef9888d3de8f322af51d300e879 /target-i386
parentx86/cpuid: Plug memory leak in cpudef_setfield() (diff)
downloadqemu-04c5b17a74c9d6c309181079f8949665b43b0164.tar.gz
qemu-04c5b17a74c9d6c309181079f8949665b43b0164.tar.xz
qemu-04c5b17a74c9d6c309181079f8949665b43b0164.zip
x86/cpuid: Fix crash on -cpu ""
Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Diffstat (limited to 'target-i386')
-rw-r--r--target-i386/cpuid.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
index 99cff65aae..21e589675c 100644
--- a/target-i386/cpuid.c
+++ b/target-i386/cpuid.c
@@ -594,9 +594,9 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model)
uint32_t numvalue;
for (def = x86_defs; def; def = def->next)
- if (!strcmp(name, def->name))
+ if (name && !strcmp(name, def->name))
break;
- if (kvm_enabled() && strcmp(name, "host") == 0) {
+ if (kvm_enabled() && name && strcmp(name, "host") == 0) {
cpu_x86_fill_host(x86_cpu_def);
} else if (!def) {
goto error;