From nobody Sat Feb 7 07:25:58 2026 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 1537296551838598.3961736481314; Tue, 18 Sep 2018 11:49:11 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BC7CE3091D70; Tue, 18 Sep 2018 18:49:09 +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 77BA860851; Tue, 18 Sep 2018 18:49:09 +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 2D2224A477; Tue, 18 Sep 2018 18:49:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8IIme6r003596 for ; Tue, 18 Sep 2018 14:48:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0A9A817581; Tue, 18 Sep 2018 18:48:40 +0000 (UTC) Received: from dahmer.redhat.com (ovpn-204-17.brq.redhat.com [10.40.204.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 307B97A42E; Tue, 18 Sep 2018 18:48:38 +0000 (UTC) From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 20:48:11 +0200 Message-Id: <20180918184818.17546-9-fidencio@redhat.com> In-Reply-To: <20180918184818.17546-1-fidencio@redhat.com> References: <20180918184818.17546-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [libvirt PATCH v6 08/15] xen_common: Adapt xenParseCPUFeatures due to changes in xenConfigGetString 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-Type: text/plain; charset="utf-8" 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 18 Sep 2018 18:49:10 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 xenConfigGetString returns a newly-allocated pointer and it has to be freed by the caller. Signed-off-by: Fabiano Fid=C3=AAncio --- src/xenconfig/xen_common.c | 50 +++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c index ab4bb7ff3f..f787827008 100644 --- a/src/xenconfig/xen_common.c +++ b/src/xenconfig/xen_common.c @@ -492,40 +492,41 @@ xenParseCPUFeatures(virConfPtr conf, virDomainXMLOptionPtr xmlopt) { unsigned long count =3D 0; - const char *str =3D NULL; + const char *cpus =3D NULL, *tsc_mode =3D NULL; int val =3D 0; virDomainTimerDefPtr timer; + int ret =3D -1; =20 if (xenConfigGetULong(conf, "vcpus", &count, 1) < 0) - return -1; + goto cleanup; =20 if (virDomainDefSetVcpusMax(def, count, xmlopt) < 0) - return -1; + goto cleanup; =20 if (virDomainDefSetVcpus(def, count) < 0) - return -1; + goto cleanup; =20 if (virConfGetValue(conf, "maxvcpus")) { if (xenConfigGetULong(conf, "maxvcpus", &count, 0) < 0) - return -1; + goto cleanup; =20 if (virDomainDefSetVcpusMax(def, count, xmlopt) < 0) - return -1; + goto cleanup; } =20 - if (xenConfigGetString(conf, "cpus", &str, NULL) < 0) - return -1; + if (xenConfigGetString(conf, "cpus", &cpus, NULL) < 0) + goto cleanup; =20 - if (str && (virBitmapParse(str, &def->cpumask, 4096) < 0)) - return -1; + if (cpus && (virBitmapParse(str, &def->cpumask, 4096) < 0)) + goto cleanup; =20 - if (xenConfigGetString(conf, "tsc_mode", &str, NULL) < 0) - return -1; + if (xenConfigGetString(conf, "tsc_mode", &tsc_mode, NULL) < 0) + goto cleanup; =20 - if (str) { + if (tsc_mode) { if (VIR_EXPAND_N(def->clock.timers, def->clock.ntimers, 1) < 0 || VIR_ALLOC(timer) < 0) - return -1; + goto cleanup; =20 timer->name =3D VIR_DOMAIN_TIMER_NAME_TSC; timer->present =3D 1; @@ -544,38 +545,38 @@ xenParseCPUFeatures(virConfPtr conf, =20 if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM) { if (xenConfigGetBool(conf, "pae", &val, 1) < 0) - return -1; + goto cleanup; =20 else if (val) def->features[VIR_DOMAIN_FEATURE_PAE] =3D VIR_TRISTATE_SWITCH_= ON; if (xenConfigGetBool(conf, "acpi", &val, 1) < 0) - return -1; + goto cleanup; =20 else if (val) def->features[VIR_DOMAIN_FEATURE_ACPI] =3D VIR_TRISTATE_SWITCH= _ON; if (xenConfigGetBool(conf, "apic", &val, 1) < 0) - return -1; + goto cleanup; =20 else if (val) def->features[VIR_DOMAIN_FEATURE_APIC] =3D VIR_TRISTATE_SWITCH= _ON; if (xenConfigGetBool(conf, "hap", &val, 1) < 0) - return -1; + goto cleanup; =20 else if (!val) def->features[VIR_DOMAIN_FEATURE_HAP] =3D VIR_TRISTATE_SWITCH_= OFF; if (xenConfigGetBool(conf, "viridian", &val, 0) < 0) - return -1; + goto cleanup; =20 else if (val) def->features[VIR_DOMAIN_FEATURE_VIRIDIAN] =3D VIR_TRISTATE_SW= ITCH_ON; =20 if (xenConfigGetBool(conf, "hpet", &val, -1) < 0) - return -1; + goto cleanup; =20 if (val !=3D -1) { if (VIR_EXPAND_N(def->clock.timers, def->clock.ntimers, 1) < 0= || VIR_ALLOC(timer) < 0) - return -1; + goto cleanup; =20 timer->name =3D VIR_DOMAIN_TIMER_NAME_HPET; timer->present =3D val; @@ -587,7 +588,12 @@ xenParseCPUFeatures(virConfPtr conf, } } =20 - return 0; + ret =3D 0; + + cleanup: + VIR_FREE(cpus); + VIR_FREE(tsc_mode); + return ret; } =20 =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list