]> git.proxmox.com Git - mirror_qemu.git/commitdiff
x86/cpuid: Fix crash on -cpu ""
authorMarkus Armbruster <armbru@redhat.com>
Tue, 8 Nov 2011 14:36:50 +0000 (15:36 +0100)
committerStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Thu, 10 Nov 2011 12:29:50 +0000 (12:29 +0000)
Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
target-i386/cpuid.c

index 99cff65aae4d47cd7ad7d637f1c35f5ae5adddfe..21e589675c5299769222965ebfb90df71177aa73 100644 (file)
@@ -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;