提交 04c5b17a 编写于 作者: M Markus Armbruster 提交者: Stefan Hajnoczi

x86/cpuid: Fix crash on -cpu ""

Spotted by Coverity.
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
上级 99e1dec0
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册