From nobody Tue May 7 21:13:15 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153261901673228.819530231661133; Thu, 26 Jul 2018 08:30:16 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9769430E6876; Thu, 26 Jul 2018 15:30:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A481C28D24; Thu, 26 Jul 2018 15:30:13 +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 AC35F4A464; Thu, 26 Jul 2018 15:30:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6QFU9C4007723 for ; Thu, 26 Jul 2018 11:30:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 467E72027EB6; Thu, 26 Jul 2018 15:30:09 +0000 (UTC) Received: from worklaptop.bos.redhat.com (dhcp-17-157.bos.redhat.com [10.18.17.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C7AF2026D68; Thu, 26 Jul 2018 15:30:09 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Thu, 26 Jul 2018 11:30:07 -0400 Message-Id: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] conf: fix virtType FromString check 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 26 Jul 2018 15:30:15 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In the domain definition, virtType is virDomainVirtType which is unsigned, so comparing against -1 doesn't work. Cast to int first Fixes 8e2982b5767 Signed-off-by: Cole Robinson --- This regressed in the past as well, when virtType was changed to virDomainVirtType in 7383b8cc068, fixed by the follow up 5e06a4f063. It's strange that virDomainVirtType is unsigned but VirtTypeFromString can return -1... it should probably either work like virArch, or we should switch virDomainVirtType to int in the DomainDef, but that requires fixing a few other places too src/conf/domain_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c27c874d9e..30806d1e59 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19140,7 +19140,7 @@ virDomainDefParseCaps(virDomainDefPtr def, "%s", _("missing domain type attribute")); goto cleanup; } - if ((def->virtType =3D virDomainVirtTypeFromString(virttype)) < 0) { + if ((int)(def->virtType =3D virDomainVirtTypeFromString(virttype)) < 0= ) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("invalid domain type %s"), virttype); goto cleanup; --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list