From nobody Mon Apr 29 09:38:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1502956560069595.5983274771093; Thu, 17 Aug 2017 00:56:00 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0324BE182A; Thu, 17 Aug 2017 07:55:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D1CE45D97A; Thu, 17 Aug 2017 07:55:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 70AAB1800C8A; Thu, 17 Aug 2017 07:55:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v7H7tuEa014537 for ; Thu, 17 Aug 2017 03:55:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4C6316031B; Thu, 17 Aug 2017 07:55:56 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-132.brq.redhat.com [10.40.204.132]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7C3B25C7C0 for ; Thu, 17 Aug 2017 07:55:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0324BE182A Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 17 Aug 2017 09:55:42 +0200 Message-Id: <20170817075542.15630-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] conf: Use the correct limit for the number of PHBs X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 17 Aug 2017 07:55:58 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" I mistakenly thought pSeries guests supported 32 PHBs, but it turns out they only support 31. Validate the target index accordingly. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1479647 Signed-off-by: Andrea Bolognani --- src/conf/domain_conf.c | 4 ++-- src/qemu/qemu_domain_address.c | 4 ++-- .../qemuxml2argv-pseries-phb-too-many.xml | 19 +++++++++++++++= ++++ tests/qemuxml2argvtest.c | 1 + 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-too-man= y.xml diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 281dc68f0..8257f04ab 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9326,10 +9326,10 @@ virDomainControllerDefParseXML(xmlNodePtr node, goto error; } if (def->opts.pciopts.targetIndex < 0 || - def->opts.pciopts.targetIndex > 31) { + def->opts.pciopts.targetIndex > 30) { virReportError(VIR_ERR_XML_ERROR, _("PCI controller target index '%s' out of " - "range - must be 0-31"), + "range - must be 0-30"), targetIndex); goto error; } diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 8066ed123..04438fae9 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -2157,9 +2157,9 @@ qemuDomainAddressFindNewTargetIndex(virDomainDefPtr d= ef) int targetIndex; int ret =3D -1; =20 - /* Try all indexes between 1 and 31 - QEMU only supports 32 + /* Try all indexes between 1 and 30 - QEMU only supports 31 * PHBs, and 0 is reserved for the default, implicit one */ - for (targetIndex =3D 1; targetIndex <=3D 31; targetIndex++) { + for (targetIndex =3D 1; targetIndex <=3D 30; targetIndex++) { bool found =3D false; size_t i; =20 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-too-many.xml b= /tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-too-many.xml new file mode 100644 index 000000000..3d99da499 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-too-many.xml @@ -0,0 +1,19 @@ + + QEMUGuest1 + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 1 + + hvm + + + /usr/bin/qemu-system-ppc64 + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 77cfe8d28..47ca90f04 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1761,6 +1761,7 @@ mymain(void) DO_TEST("pseries-phb-simple", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE); + DO_TEST_PARSE_ERROR("pseries-phb-too-many", NONE); DO_TEST("pseries-phb-default-missing", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE); --=20 2.13.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list