From 4e4c29a1198b5bb0af7cfaa666acd8b071f1b4c8 Mon Sep 17 00:00:00 2001 Message-Id: <4e4c29a1198b5bb0af7cfaa666acd8b071f1b4c8.1265024610.git.jdenemar@redhat.com> From: Jiri Denemark Date: Mon, 1 Feb 2010 12:42:27 +0100 Subject: [PATCH] Move models/nmodels mismatch checking one level up Mail-Followup-To: libvir-list@redhat.com Signed-off-by: Jiri Denemark --- src/cpu/cpu.c | 6 ++++++ src/cpu/cpu_x86.c | 3 --- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 975ca28..3e46948 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -128,6 +128,12 @@ cpuDecode(virConnectPtr conn, { struct cpuArchDriver *driver; + if (models == NULL && nmodels != 0) { + virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + "%s", _("nonzero nmodels doesn't match with NULL models")); + return -1; + } + if (cpu == NULL) { virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s", _("invalid CPU definition")); diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 47dc400..ce55588 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -954,9 +954,6 @@ x86Decode(virCPUDefPtr cpu, if (data == NULL || (map = x86LoadMap()) == NULL) return -1; - if (models == NULL && nmodels != 0) - return -1; - candidate = map->models; while (candidate != NULL) { bool allowed = (models == NULL); -- 1.6.6.1