diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 731df26ea764f66613d8a1cb68002e666faec52c..1952b53ecf1b1b299e3929644960f553f34e75e6 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -142,12 +142,6 @@ cpuCompare(virCPUDefPtr host, VIR_DEBUG("host=%p, cpu=%p", host, cpu); - if (!cpu->model) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("no guest CPU model specified")); - return VIR_CPU_COMPARE_ERROR; - } - if ((driver = cpuGetSubDriver(host->arch)) == NULL) return VIR_CPU_COMPARE_ERROR; @@ -376,12 +370,6 @@ cpuGuestData(virCPUDefPtr host, VIR_DEBUG("host=%p, guest=%p, data=%p, msg=%p", host, guest, data, msg); - if (!guest->model) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("no guest CPU model specified")); - return VIR_CPU_COMPARE_ERROR; - } - if ((driver = cpuGetSubDriver(host->arch)) == NULL) return VIR_CPU_COMPARE_ERROR; diff --git a/src/cpu/cpu_generic.c b/src/cpu/cpu_generic.c index a9cde4ca3c612dd5cdaa65b7b445d35d165b1c8c..f26a62dc63b1c4344a99ecdf2a08373a89085c26 100644 --- a/src/cpu/cpu_generic.c +++ b/src/cpu/cpu_generic.c @@ -65,6 +65,12 @@ genericCompare(virCPUDefPtr host, size_t i; unsigned int reqfeatures; + if (!cpu->model) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("no guest CPU model specified")); + goto cleanup; + } + if ((cpu->arch != VIR_ARCH_NONE && host->arch != cpu->arch) || STRNEQ(host->model, cpu->model)) { diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index a72cc32ae4327cf6934d9d4ba3cd83e0ba60854b..364c8ed082093263b96661f7329981227b3e0b99 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -71,7 +71,8 @@ ppc64ConvertLegacyCPUDef(const virCPUDef *legacy) if (!(cpu = virCPUDefCopy(legacy))) goto out; - if (!(STREQ(cpu->model, "POWER7_v2.1") || + if (!cpu->model || + !(STREQ(cpu->model, "POWER7_v2.1") || STREQ(cpu->model, "POWER7_v2.3") || STREQ(cpu->model, "POWER7+_v2.1") || STREQ(cpu->model, "POWER8_v1.0"))) { diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index f5f769730e279dc72191660c2cc4f303a50e8ae4..90949f68cce125ce925e7bd422b62ce07e2514f7 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1371,6 +1371,12 @@ x86Compute(virCPUDefPtr host, virArch arch; size_t i; + if (!cpu->model) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("no guest CPU model specified")); + return VIR_CPU_COMPARE_ERROR; + } + if (cpu->arch != VIR_ARCH_NONE) { bool found = false;