From nobody Thu May 2 08:03:10 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 ARC-Seal: i=1; a=rsa-sha256; t=1569401945; cv=none; d=zoho.com; s=zohoarc; b=hLKLm7VOnSsraCYOvpzi+bRhFm3BMVOUAV76VOaGY1G/zVSTJ7AgVO3K2JutVQPehDFEmke2zNnj8xA2B8bNrSPQPXyNzL/+EhNnYcTpzMnlIp/Nk2KtFWMlBsHaXzpkaxRRUuvQcC+Gww/lQ5Cw6dsi0sPG1QrW1E0/9L5Rj6Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569401945; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=qIzeF2FYnsnLtc/ch0HpAmmo7f3eFS8TaVN9Mg4jDO8=; b=FLjhPvExqg4pI69mtuczg36cLarrE87RjfkFz8o9EQT+3vBrLecUZnulD8c5YwIb3xtI1Jcs8cylraM8oHE2SKViYpspsnlcnuF+dFKFdqT2rnZHNIxUn7lEi0u4h1g1CnHGGXrEgcWHg9i2EHPIQhxCmeXxPUIaDsRA23F6cRw= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1569401945419587.8118466764458; Wed, 25 Sep 2019 01:59:05 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 425623090FC6; Wed, 25 Sep 2019 08:59:02 +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 3A69061559; Wed, 25 Sep 2019 08:59:00 +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 9733418005A0; Wed, 25 Sep 2019 08:58:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8P8ws69023313 for ; Wed, 25 Sep 2019 04:58:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id A468760923; Wed, 25 Sep 2019 08:58:54 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2EDD0608C2 for ; Wed, 25 Sep 2019 08:58:51 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 25 Sep 2019 10:58:16 +0200 Message-Id: <20cc7f9e8a3324a4ba7dcd126a656386ea212b29.1569401876.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] domain_conf: Fix str2enum translation of video driver name 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: , 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 25 Sep 2019 08:59:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" In bc1e924cf0d we've introduced video driver name and whilst doing so we've utilized VIR_ENUM_IMPL() macro. Then, in domain XML parsing code the generated virDomainVideoBackendTypeFromString() is called and its return value is assigned directly to an unsigned int variable which is wrong. Also, the video driver enum has 'default' value which is not formatted into domain XML but is accepted during parsing. Signed-off-by: Michal Privoznik --- Pushed under trivial & build breaker rules. src/conf/domain_conf.c | 4 +++- src/conf/domain_conf.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6dea670257..67555c9be3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15504,11 +15504,13 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr x= mlopt, } =20 if (driver_name) { - if ((def->backend =3D virDomainVideoBackendTypeFromString(driver_n= ame)) < 0) { + int backend; + if ((backend =3D virDomainVideoBackendTypeFromString(driver_name))= <=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown video driver '%s'"), driver_name); goto error; } + def->backend =3D backend; } else { def->backend =3D VIR_DOMAIN_VIDEO_BACKEND_TYPE_DEFAULT; } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index cff33f6682..53bdee22fb 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1378,7 +1378,7 @@ struct _virDomainWatchdogDef { =20 /* the backend driver used for virtio interfaces */ typedef enum { - VIR_DOMAIN_VIDEO_BACKEND_TYPE_DEFAULT, + VIR_DOMAIN_VIDEO_BACKEND_TYPE_DEFAULT =3D 0, VIR_DOMAIN_VIDEO_BACKEND_TYPE_QEMU, VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER, =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list