From nobody Sat May 4 13:13:12 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 1537296519122823.3406648987699; Tue, 18 Sep 2018 11:48:39 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B9AD580F95; Tue, 18 Sep 2018 18:48:36 +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 87EE31001F56; Tue, 18 Sep 2018 18:48:36 +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 6A0264BB7F; Tue, 18 Sep 2018 18:48:34 +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 w8IImVFM003530 for ; Tue, 18 Sep 2018 14:48:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 42F3917581; Tue, 18 Sep 2018 18:48:31 +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 5C9D37A431; Tue, 18 Sep 2018 18:48:30 +0000 (UTC) From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 20:48:04 +0200 Message-Id: <20180918184818.17546-2-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 01/15] xen_common: Change xenConfigCopyStringInternal to using virConfGetValueString 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 18 Sep 2018 18:48:37 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Signed-off-by: Fabiano Fid=C3=AAncio Reviewed-by: John Ferlan --- src/xenconfig/xen_common.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c index 36a9d27c80..a35e1aff58 100644 --- a/src/xenconfig/xen_common.c +++ b/src/xenconfig/xen_common.c @@ -145,23 +145,13 @@ xenConfigCopyStringInternal(virConfPtr conf, char **value, int allowMissing) { - virConfValuePtr val; + int rc; =20 *value =3D NULL; - if (!(val =3D virConfGetValue(conf, name))) { - if (allowMissing) - return 0; - virReportError(VIR_ERR_INTERNAL_ERROR, - _("config value %s was missing"), name); + if ((rc =3D virConfGetValueString(conf, name, value)) < 0) return -1; - } =20 - if (val->type !=3D VIR_CONF_STRING) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("config value %s was not a string"), name); - return -1; - } - if (!val->str) { + if (rc =3D=3D 0) { if (allowMissing) return 0; virReportError(VIR_ERR_INTERNAL_ERROR, @@ -169,7 +159,7 @@ xenConfigCopyStringInternal(virConfPtr conf, return -1; } =20 - return VIR_STRDUP(*value, val->str); + return 1; } =20 =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:13:12 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 1537296539343979.6993685371588; Tue, 18 Sep 2018 11:48:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 21C4C308FF16; Tue, 18 Sep 2018 18:48:57 +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 C8406183D2; Tue, 18 Sep 2018 18:48:56 +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 75A48181A12F; Tue, 18 Sep 2018 18:48:56 +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 w8IImW3i003540 for ; Tue, 18 Sep 2018 14:48:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8350B7A43A; Tue, 18 Sep 2018 18:48:32 +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 9A18017581; Tue, 18 Sep 2018 18:48:31 +0000 (UTC) From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 20:48:05 +0200 Message-Id: <20180918184818.17546-3-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 02/15] xen_common: Change xenConfigGetUUID to using virConfGetValueString 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 18 Sep 2018 18:48:57 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Signed-off-by: Fabiano Fid=C3=AAncio Reviewed-by: John Ferlan --- src/xenconfig/xen_common.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c index a35e1aff58..08fbfff44f 100644 --- a/src/xenconfig/xen_common.c +++ b/src/xenconfig/xen_common.c @@ -183,7 +183,7 @@ xenConfigCopyStringOpt(virConfPtr conf, const char *nam= e, char **value) static int xenConfigGetUUID(virConfPtr conf, const char *name, unsigned char *uuid) { - virConfValuePtr val; + char *string =3D NULL; =20 if (!uuid || !name || !conf) { virReportError(VIR_ERR_INVALID_ARG, "%s", @@ -191,7 +191,7 @@ xenConfigGetUUID(virConfPtr conf, const char *name, uns= igned char *uuid) return -1; } =20 - if (!(val =3D virConfGetValue(conf, name))) { + if (virConfGetValueString(conf, name, &string) <=3D 0) { if (virUUIDGenerate(uuid) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Failed to generate UUID")); @@ -201,24 +201,20 @@ xenConfigGetUUID(virConfPtr conf, const char *name, u= nsigned char *uuid) } } =20 - if (val->type !=3D VIR_CONF_STRING) { - virReportError(VIR_ERR_CONF_SYNTAX, - _("config value %s not a string"), name); - return -1; - } - - if (!val->str) { + if (!string) { virReportError(VIR_ERR_CONF_SYNTAX, _("%s can't be empty"), name); return -1; } =20 - if (virUUIDParse(val->str, uuid) < 0) { + if (virUUIDParse(string, uuid) < 0) { virReportError(VIR_ERR_CONF_SYNTAX, _("%s not parseable"), val->str); + VIR_FREE(string); return -1; } =20 + VIR_FREE(string); return 0; } =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:13:12 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 153729651903283.0363132845174; Tue, 18 Sep 2018 11:48:39 -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 BF7343082E71; Tue, 18 Sep 2018 18:48:36 +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 8201C4501; Tue, 18 Sep 2018 18:48:36 +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 BDF5E4A460; Tue, 18 Sep 2018 18:48:34 +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 w8IImXdV003545 for ; Tue, 18 Sep 2018 14:48:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id B2B9F7A42E; Tue, 18 Sep 2018 18:48:33 +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 E1AB817581; Tue, 18 Sep 2018 18:48:32 +0000 (UTC) From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 20:48:06 +0200 Message-Id: <20180918184818.17546-4-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 03/15] xen_common: Change xenConfigGetString to using virConfGetValueString 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.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]); Tue, 18 Sep 2018 18:48:37 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 This change actually changes the behaviour of xenConfigGetString() as now it returns a newly-allocated string. Unfortunately, there's not much that can be done in order to avoid that and all the needed changes in callers in order to not leak the returned value are coming in the following patches. Signed-off-by: Fabiano Fid=C3=AAncio --- src/xenconfig/xen_common.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c index 08fbfff44f..c044cb9672 100644 --- a/src/xenconfig/xen_common.c +++ b/src/xenconfig/xen_common.c @@ -228,23 +228,23 @@ xenConfigGetString(virConfPtr conf, const char **value, const char *def) { - virConfValuePtr val; + char *string =3D NULL; + int rc; =20 *value =3D NULL; - if (!(val =3D virConfGetValue(conf, name))) { - *value =3D def; + if ((rc =3D virConfGetValueString(conf, name, &string)) < 0) + return -1; + + if (rc =3D=3D 0) { + *value =3D VIR_STRDUP(def); return 0; } =20 - if (val->type !=3D VIR_CONF_STRING) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("config value %s was malformed"), name); - return -1; - } - if (!val->str) - *value =3D def; + if (!string) + *value =3D VIR_STRDUP(def); else - *value =3D val->str; + *value =3D string; + return 0; } =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:13:12 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 1537296543941866.4739660234612; Tue, 18 Sep 2018 11:49:03 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 51DC230014CB; Tue, 18 Sep 2018 18:49:01 +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 0A3C43091376; Tue, 18 Sep 2018 18:49:01 +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 AEC79181A13C; Tue, 18 Sep 2018 18:49:00 +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 w8IImZ0Z003553 for ; Tue, 18 Sep 2018 14:48:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 06CE617581; Tue, 18 Sep 2018 18:48:35 +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 2CC2F7A431; Tue, 18 Sep 2018 18:48:33 +0000 (UTC) From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 20:48:07 +0200 Message-Id: <20180918184818.17546-5-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 04/15] xen_xl: Adapt xenParseCmdline 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 18 Sep 2018 18:49:02 +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_xl.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index 19b6604e05..e4ef061cdb 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -65,37 +65,44 @@ extern int xlu_disk_parse(XLU_Config *cfg, static int xenParseCmdline(virConfPtr conf, char **r_cmdline) { char *cmdline =3D NULL; - const char *root, *extra, *buf; + const char *root =3D NULL, *extra =3D NULL, *buf =3D NULL; + int ret =3D -1; =20 if (xenConfigGetString(conf, "cmdline", &buf, NULL) < 0) - return -1; + goto cleanup; =20 if (xenConfigGetString(conf, "root", &root, NULL) < 0) - return -1; + goto cleanup; =20 if (xenConfigGetString(conf, "extra", &extra, NULL) < 0) - return -1; + goto cleanup; =20 if (buf) { if (VIR_STRDUP(cmdline, buf) < 0) - return -1; + goto cleanup; if (root || extra) VIR_WARN("ignoring root=3D and extra=3D in favour of cmdline= =3D"); } else { if (root && extra) { if (virAsprintf(&cmdline, "root=3D%s %s", root, extra) < 0) - return -1; + goto cleanup; } else if (root) { if (virAsprintf(&cmdline, "root=3D%s", root) < 0) - return -1; + goto cleanup; } else if (extra) { if (VIR_STRDUP(cmdline, extra) < 0) - return -1; + goto cleanup; } } =20 *r_cmdline =3D cmdline; - return 0; + ret =3D 0; + + cleanup: + VIR_FREE(buf); + VIR_FREE(extra); + VIR_FREE(root); + return ret; } =20 static int --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:13:12 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 1537296548311788.6736967742286; Tue, 18 Sep 2018 11:49:08 -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 AC73731500AB; Tue, 18 Sep 2018 18:49:05 +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 753307A431; Tue, 18 Sep 2018 18:49:05 +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 1878B4A472; Tue, 18 Sep 2018 18:49:05 +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 w8IIma9G003568 for ; Tue, 18 Sep 2018 14:48:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4521817581; Tue, 18 Sep 2018 18:48:36 +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 5E7427A436; Tue, 18 Sep 2018 18:48:35 +0000 (UTC) From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 20:48:08 +0200 Message-Id: <20180918184818.17546-6-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 05/15] xen_xl: Adapt xenParseXLOS 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 18 Sep 2018 18:49:06 +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_xl.c | 45 ++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index e4ef061cdb..cb1cab8482 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -108,26 +108,28 @@ static int xenParseCmdline(virConfPtr conf, char **r_= cmdline) static int xenParseXLOS(virConfPtr conf, virDomainDefPtr def, virCapsPtr caps) { + int ret =3D -1; size_t i; + const char *bios =3D NULL; + const char *boot =3D NULL; + =20 if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM) { - const char *bios; - const char *boot; int val =3D 0; =20 if (xenConfigGetString(conf, "bios", &bios, NULL) < 0) - return -1; + goto cleanup; =20 if (bios && STREQ(bios, "ovmf")) { if (VIR_ALLOC(def->os.loader) < 0) - return -1; + goto cleanup; =20 def->os.loader->type =3D VIR_DOMAIN_LOADER_TYPE_PFLASH; def->os.loader->readonly =3D VIR_TRISTATE_BOOL_YES; =20 if (VIR_STRDUP(def->os.loader->path, LIBXL_FIRMWARE_DIR "/ovmf.bin") < 0) - return -1; + goto cleanup; } else { for (i =3D 0; i < caps->nguests; i++) { if (caps->guests[i]->ostype =3D=3D VIR_DOMAIN_OSTYPE_HVM && @@ -135,24 +137,24 @@ xenParseXLOS(virConfPtr conf, virDomainDefPtr def, vi= rCapsPtr caps) if (VIR_ALLOC(def->os.loader) < 0 || VIR_STRDUP(def->os.loader->path, caps->guests[i]->arch.defaultInfo.loade= r) < 0) - return -1; + goto cleanup; } } } =20 #ifdef LIBXL_HAVE_BUILDINFO_KERNEL if (xenConfigCopyStringOpt(conf, "kernel", &def->os.kernel) < 0) - return -1; + goto cleanup; =20 if (xenConfigCopyStringOpt(conf, "ramdisk", &def->os.initrd) < 0) - return -1; + goto cleanup; =20 if (xenParseCmdline(conf, &def->os.cmdline) < 0) - return -1; + goto cleanup; #endif =20 if (xenConfigGetString(conf, "boot", &boot, "c") < 0) - return -1; + goto cleanup; =20 for (i =3D 0; i < VIR_DOMAIN_BOOT_LAST && boot[i]; i++) { switch (boot[i]) { @@ -174,7 +176,7 @@ xenParseXLOS(virConfPtr conf, virDomainDefPtr def, virC= apsPtr caps) } =20 if (xenConfigGetBool(conf, "nestedhvm", &val, -1) < 0) - return -1; + goto cleanup; =20 if (val !=3D -1) { const char *vtfeature =3D "vmx"; @@ -189,7 +191,7 @@ xenParseXLOS(virConfPtr conf, virDomainDefPtr def, virC= apsPtr caps) if (!def->cpu) { virCPUDefPtr cpu; if (VIR_ALLOC(cpu) < 0) - return -1; + goto cleanup; =20 cpu->mode =3D VIR_CPU_MODE_HOST_PASSTHROUGH; cpu->type =3D VIR_CPU_TYPE_GUEST; @@ -202,26 +204,31 @@ xenParseXLOS(virConfPtr conf, virDomainDefPtr def, vi= rCapsPtr caps) if (virCPUDefAddFeature(def->cpu, vtfeature, VIR_CPU_FEATURE_DISABLE) < 0) - return -1; + goto cleanup; } } } else { if (xenConfigCopyStringOpt(conf, "bootloader", &def->os.bootloader= ) < 0) - return -1; + goto cleanup; if (xenConfigCopyStringOpt(conf, "bootargs", &def->os.bootloaderAr= gs) < 0) - return -1; + goto cleanup; =20 if (xenConfigCopyStringOpt(conf, "kernel", &def->os.kernel) < 0) - return -1; + goto cleanup; =20 if (xenConfigCopyStringOpt(conf, "ramdisk", &def->os.initrd) < 0) - return -1; + goto cleanup; =20 if (xenParseCmdline(conf, &def->os.cmdline) < 0) - return -1; + goto cleanup; } =20 - return 0; + ret =3D 0; + + cleanup: + VIR_FREE(bios); + VIR_FREE(boot); + return ret; } =20 /* --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:13:12 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 153729653895012.5651965661433; Tue, 18 Sep 2018 11:48:58 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DDF20308214B; Tue, 18 Sep 2018 18:48:56 +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 97AB55C6C1; Tue, 18 Sep 2018 18:48:56 +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 3A93A181A12D; Tue, 18 Sep 2018 18:48:56 +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 w8IImbFn003576 for ; Tue, 18 Sep 2018 14:48:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 83FFE7A42E; Tue, 18 Sep 2018 18:48:37 +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 A77CD17581; Tue, 18 Sep 2018 18:48:36 +0000 (UTC) From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 20:48:09 +0200 Message-Id: <20180918184818.17546-7-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 06/15] xen_xl: adapt xenParseXLCPUID 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.16 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:48:57 +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_xl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index cb1cab8482..7d86849feb 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -346,6 +346,7 @@ xenParseXLCPUID(virConfPtr conf, virDomainDefPtr def) ret =3D 0; =20 cleanup: + VIR_FREE(cpuid_str); virStringListFree(name_and_value); virStringListFree(cpuid_pairs); return ret; --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:13:12 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 1537296543100835.1250602449958; Tue, 18 Sep 2018 11:49:03 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 130FC8762B; Tue, 18 Sep 2018 18:49:01 +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 D21291001F5B; Tue, 18 Sep 2018 18:49: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 7A48F181A13B; Tue, 18 Sep 2018 18:49:00 +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 w8IImcO5003591 for ; Tue, 18 Sep 2018 14:48:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id C1A507A430; Tue, 18 Sep 2018 18:48:38 +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 DAACD17581; Tue, 18 Sep 2018 18:48:37 +0000 (UTC) From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 20:48:10 +0200 Message-Id: <20180918184818.17546-8-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 07/15] xen_common: Adapt xenParseEventsActions 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 18 Sep 2018 18:49:01 +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 | 41 ++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c index c044cb9672..ab4bb7ff3f 100644 --- a/src/xenconfig/xen_common.c +++ b/src/xenconfig/xen_common.c @@ -342,36 +342,43 @@ xenParseTimeOffset(virConfPtr conf, virDomainDefPtr d= ef) static int xenParseEventsActions(virConfPtr conf, virDomainDefPtr def) { - const char *str =3D NULL; + const char *on_poweroff =3D NULL, *on_reboot =3D NULL, *on_crash =3D N= ULL; + int ret =3D -1; =20 - if (xenConfigGetString(conf, "on_poweroff", &str, "destroy") < 0) - return -1; + if (xenConfigGetString(conf, "on_poweroff", &on_poweroff, "destroy") <= 0) + goto cleanup; =20 - if ((def->onPoweroff =3D virDomainLifecycleActionTypeFromString(str)) = < 0) { + if ((def->onPoweroff =3D virDomainLifecycleActionTypeFromString(on_pow= eroff)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected value %s for on_poweroff"), str); - return -1; + _("unexpected value %s for on_poweroff"), on_powero= ff); + goto cleanup; } =20 - if (xenConfigGetString(conf, "on_reboot", &str, "restart") < 0) - return -1; + if (xenConfigGetString(conf, "on_reboot", &on_reboot, "restart") < 0) + goto cleanup; =20 - if ((def->onReboot =3D virDomainLifecycleActionTypeFromString(str)) < = 0) { + if ((def->onReboot =3D virDomainLifecycleActionTypeFromString(on_reboo= t)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected value %s for on_reboot"), str); - return -1; + _("unexpected value %s for on_reboot"), on_reboot); + goto cleanup; } =20 - if (xenConfigGetString(conf, "on_crash", &str, "restart") < 0) - return -1; + if (xenConfigGetString(conf, "on_crash", &on_crash, "restart") < 0) + goto cleanup; =20 - if ((def->onCrash =3D virDomainLifecycleActionTypeFromString(str)) < 0= ) { + if ((def->onCrash =3D virDomainLifecycleActionTypeFromString(on_crash)= ) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected value %s for on_crash"), str); - return -1; + _("unexpected value %s for on_crash"), on_crash); + goto cleanup; } =20 - return 0; + ret =3D 0; + + cleanup: + VIR_FREE(on_poweroff); + VIR_FREE(on_reboot); + VIR_FREE(on_crash); + return ret; } =20 =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:13:12 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 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 From nobody Sat May 4 13:13:12 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 1537296537415743.6440456026949; Tue, 18 Sep 2018 11:48:57 -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 A998D308ED53; Tue, 18 Sep 2018 18:48:54 +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 758E160851; Tue, 18 Sep 2018 18:48:54 +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 295F6180053A; Tue, 18 Sep 2018 18:48:54 +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 w8IImfH2003604 for ; Tue, 18 Sep 2018 14:48:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 48B947A435; Tue, 18 Sep 2018 18:48:41 +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 636EB17581; Tue, 18 Sep 2018 18:48:40 +0000 (UTC) From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 20:48:12 +0200 Message-Id: <20180918184818.17546-10-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 09/15] xen_common: Adapt xenParseEmulatedDevices 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.44]); Tue, 18 Sep 2018 18:48:56 +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 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c index f787827008..5d88577222 100644 --- a/src/xenconfig/xen_common.c +++ b/src/xenconfig/xen_common.c @@ -1060,17 +1060,22 @@ static int xenParseEmulatedDevices(virConfPtr conf, virDomainDefPtr def) { const char *str; + int ret =3D -1; =20 if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM) { if (xenConfigGetString(conf, "soundhw", &str, NULL) < 0) - return -1; + goto cleanup; =20 if (str && xenParseSxprSound(def, str) < 0) - return -1; + goto cleanup; } =20 - return 0; + ret =3D 0; + + cleanup: + VIR_FREE(str); + return ret; } =20 =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:13:12 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 1537296555787163.0091255674314; Tue, 18 Sep 2018 11:49:15 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C476743A26; Tue, 18 Sep 2018 18:49:13 +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 96B942015AE5; Tue, 18 Sep 2018 18:49: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 40C79181A531; Tue, 18 Sep 2018 18:49:13 +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 w8IImjG2003624 for ; Tue, 18 Sep 2018 14:48:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0D8507A42E; Tue, 18 Sep 2018 18:48:45 +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 D218617581; Tue, 18 Sep 2018 18:48:41 +0000 (UTC) From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 20:48:13 +0200 Message-Id: <20180918184818.17546-11-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 10/15] xen_common: Adapt xenParseGeneralMeta 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.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 18 Sep 2018 18:49:14 +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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c index 5d88577222..09f93ba449 100644 --- a/src/xenconfig/xen_common.c +++ b/src/xenconfig/xen_common.c @@ -1083,7 +1083,7 @@ static int xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr def, virCapsPtr caps) { virCapsDomainDataPtr capsdata =3D NULL; - const char *str; + const char *str =3D NULL; int hvm =3D 0, ret =3D -1; =20 if (xenConfigCopyString(conf, "name", &def->name) < 0) @@ -1108,6 +1108,7 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr = def, virCapsPtr caps) =20 ret =3D 0; out: + VIR_FREE(str); VIR_FREE(capsdata); return ret; } --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:13:12 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 1537296552253714.8767927993346; Tue, 18 Sep 2018 11:49:12 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 23A9D88316; Tue, 18 Sep 2018 18:49:10 +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 E643D897F6; 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 997E34A479; 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 w8IImmIN003637 for ; Tue, 18 Sep 2018 14:48:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 939507A42E; Tue, 18 Sep 2018 18:48:48 +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 71B5917581; Tue, 18 Sep 2018 18:48:45 +0000 (UTC) From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 20:48:14 +0200 Message-Id: <20180918184818.17546-12-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 11/15] xen_xm: Adapt xenParseXMOS 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.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 18 Sep 2018 18:49:11 +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_xm.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/xenconfig/xen_xm.c b/src/xenconfig/xen_xm.c index 7b60f25ec1..a476401183 100644 --- a/src/xenconfig/xen_xm.c +++ b/src/xenconfig/xen_xm.c @@ -42,16 +42,16 @@ static int xenParseXMOS(virConfPtr conf, virDomainDefPtr def) { size_t i; + int ret =3D -1; + const char *boot =3D NULL, *extra =3D NULL, *root =3D NULL; =20 if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM) { - const char *boot; - if (VIR_ALLOC(def->os.loader) < 0 || xenConfigCopyString(conf, "kernel", &def->os.loader->path) < 0) - return -1; + goto cleanup; =20 if (xenConfigGetString(conf, "boot", &boot, "c") < 0) - return -1; + goto cleanup; =20 for (i =3D 0; i < VIR_DOMAIN_BOOT_LAST && boot[i]; i++) { switch (boot[i]) { @@ -72,38 +72,42 @@ xenParseXMOS(virConfPtr conf, virDomainDefPtr def) def->os.nBootDevs++; } } else { - const char *extra, *root; - if (xenConfigCopyStringOpt(conf, "bootloader", &def->os.bootloader= ) < 0) - return -1; + goto cleanup; if (xenConfigCopyStringOpt(conf, "bootargs", &def->os.bootloaderAr= gs) < 0) - return -1; + goto cleanup; =20 if (xenConfigCopyStringOpt(conf, "kernel", &def->os.kernel) < 0) - return -1; + goto cleanup; =20 if (xenConfigCopyStringOpt(conf, "ramdisk", &def->os.initrd) < 0) - return -1; + goto cleanup; =20 if (xenConfigGetString(conf, "extra", &extra, NULL) < 0) - return -1; + goto cleanup; =20 if (xenConfigGetString(conf, "root", &root, NULL) < 0) - return -1; + goto cleanup; =20 if (root && extra) { if (virAsprintf(&def->os.cmdline, "root=3D%s %s", root, extra)= < 0) - return -1; + goto cleanup; } else if (root) { if (virAsprintf(&def->os.cmdline, "root=3D%s", root) < 0) - return -1; + goto cleanup; } else if (extra) { if (VIR_STRDUP(def->os.cmdline, extra) < 0) - return -1; + goto cleanup; } } =20 - return 0; + ret =3D 0; + + cleanup: + VIR_FREE(extra); + VIR_FREE(root); + VIR_FREE(boot); + return ret; } =20 =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:13:12 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 1537296541012189.1569760725389; Tue, 18 Sep 2018 11:49:01 -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 EE7D5307C718; Tue, 18 Sep 2018 18:48:58 +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 BE7AD7A436; Tue, 18 Sep 2018 18:48:58 +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 725E64BB75; Tue, 18 Sep 2018 18:48:58 +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 w8IImnY9003642 for ; Tue, 18 Sep 2018 14:48:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id D2CAE17581; Tue, 18 Sep 2018 18:48:49 +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 0296A7A436; Tue, 18 Sep 2018 18:48:48 +0000 (UTC) From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 20:48:15 +0200 Message-Id: <20180918184818.17546-13-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 12/15] xen_xm: Adapt xenParseXMInputDevs 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.15 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:48:59 +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_xm.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/xenconfig/xen_xm.c b/src/xenconfig/xen_xm.c index a476401183..4bff727e04 100644 --- a/src/xenconfig/xen_xm.c +++ b/src/xenconfig/xen_xm.c @@ -422,17 +422,18 @@ static int xenParseXMInputDevs(virConfPtr conf, virDomainDefPtr def) { const char *str; + int ret =3D -1; =20 if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM) { if (xenConfigGetString(conf, "usbdevice", &str, NULL) < 0) - return -1; + goto cleanup; if (str && (STREQ(str, "tablet") || STREQ(str, "mouse") || STREQ(str, "keyboard"))) { virDomainInputDefPtr input; if (VIR_ALLOC(input) < 0) - return -1; + goto cleanup; =20 input->bus =3D VIR_DOMAIN_INPUT_BUS_USB; if (STREQ(str, "mouse")) @@ -443,11 +444,14 @@ xenParseXMInputDevs(virConfPtr conf, virDomainDefPtr = def) input->type =3D VIR_DOMAIN_INPUT_TYPE_KBD; if (VIR_APPEND_ELEMENT(def->inputs, def->ninputs, input) < 0) { virDomainInputDefFree(input); - return -1; + goto cleanup; } } } - return 0; + ret =3D 0; + + cleanup: + return ret; } =20 /* --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:13:12 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 1537296555908814.9430833029978; Tue, 18 Sep 2018 11:49:15 -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 4AA13311C3DE; Tue, 18 Sep 2018 18:49:14 +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 128FE16D45; Tue, 18 Sep 2018 18:49:14 +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 BEA93181A530; Tue, 18 Sep 2018 18:49:13 +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 w8IImpra003652 for ; Tue, 18 Sep 2018 14:48:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1BE407A42E; Tue, 18 Sep 2018 18:48:51 +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 4047C17581; Tue, 18 Sep 2018 18:48:50 +0000 (UTC) From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 20:48:16 +0200 Message-Id: <20180918184818.17546-14-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 13/15] xen_common: Change xenParsePCIList to using virConfGetValueStringList 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.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.44]); Tue, 18 Sep 2018 18:49:14 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 The `if (!list || list->type !=3D VIR_CONF_LIST)` couldn't be written in a 100% similar way as `if (virConfGetValueStringList(conf, "pci", false, &pcis) <=3D 0)` leads us to just ignore any error and return 0 in case of failure. However, for what's needed in this function, this is the closest to the original that we can get and it shouldn't change the function behaviour. Signed-off-by: Fabiano Fid=C3=AAncio --- src/xenconfig/xen_common.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c index 09f93ba449..9ad081e56b 100644 --- a/src/xenconfig/xen_common.c +++ b/src/xenconfig/xen_common.c @@ -462,27 +462,30 @@ xenParsePCI(char *entry) static int xenParsePCIList(virConfPtr conf, virDomainDefPtr def) { - virConfValuePtr list =3D virConfGetValue(conf, "pci"); + char **pcis =3D NULL, **entries; + int ret =3D -1; =20 - if (!list || list->type !=3D VIR_CONF_LIST) + if (virConfGetValueStringList(conf, "pci", false, &pcis) <=3D 0) return 0; =20 - for (list =3D list->list; list; list =3D list->next) { + for (entries =3D pcis; *entries; entries++) { + char *entry =3D *entries; virDomainHostdevDefPtr hostdev; =20 - if ((list->type !=3D VIR_CONF_STRING) || (list->str =3D=3D NULL)) - continue; - - if (!(hostdev =3D xenParsePCI(list->str))) - return -1; + if (!(hostdev =3D xenParsePCI(entry))) + goto cleanup; =20 if (VIR_APPEND_ELEMENT(def->hostdevs, def->nhostdevs, hostdev) < 0= ) { virDomainHostdevDefFree(hostdev); - return -1; + goto cleanup; } } =20 - return 0; + ret =3D 0; + + cleanup: + virStringListFree(pcis); + return ret; } =20 =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:13:12 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 1537296560052870.1225418833716; Tue, 18 Sep 2018 11:49:20 -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 EBB70C070133; Tue, 18 Sep 2018 18:49:17 +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 B86037EED9; Tue, 18 Sep 2018 18:49:17 +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 6DDFB181A860; Tue, 18 Sep 2018 18:49:17 +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 w8IImqH5003660 for ; Tue, 18 Sep 2018 14:48:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 59AF317581; Tue, 18 Sep 2018 18:48:52 +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 849C27A436; Tue, 18 Sep 2018 18:48:51 +0000 (UTC) From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 20:48:17 +0200 Message-Id: <20180918184818.17546-15-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 14/15] xen_common: Change xenParseVfbs to using virConfGetValueStringList 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.31]); Tue, 18 Sep 2018 18:49:19 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Signed-off-by: Fabiano Fid=C3=AAncio --- src/xenconfig/xen_common.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c index 9ad081e56b..a6e77a9250 100644 --- a/src/xenconfig/xen_common.c +++ b/src/xenconfig/xen_common.c @@ -605,8 +605,10 @@ xenParseCPUFeatures(virConfPtr conf, static int xenParseVfb(virConfPtr conf, virDomainDefPtr def) { + int ret =3D -1; int val; char *listenAddr =3D NULL; + char **vfbs =3D NULL; int hvm =3D def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM; virConfValuePtr list; virDomainGraphicsDefPtr graphics =3D NULL; @@ -664,17 +666,14 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def) } =20 if (!hvm && def->graphics =3D=3D NULL) { /* New PV guests use this for= mat */ - list =3D virConfGetValue(conf, "vfb"); - if (list && list->type =3D=3D VIR_CONF_LIST && - list->list && list->list->type =3D=3D VIR_CONF_STRING && - list->list->str) { + if (virConfGetValueStringList(conf, "vfb", false, &vfbs) =3D=3D 1)= { char vfb[MAX_VFB]; char *key =3D vfb; =20 - if (virStrcpyStatic(vfb, list->list->str) < 0) { + if (virStrcpyStatic(vfb, *vfbs) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("VFB %s too big for destination"), - list->list->str); + *vfbs); goto cleanup; } =20 @@ -747,12 +746,13 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def) } } =20 - return 0; + ret =3D 0; =20 cleanup: virDomainGraphicsDefFree(graphics); VIR_FREE(listenAddr); - return -1; + virStringListFree(vfbs); + return ret; } =20 =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:13:12 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 1537296545106929.1172735861946; Tue, 18 Sep 2018 11:49:05 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3AF5F3091D4E; Tue, 18 Sep 2018 18:49:03 +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 0583213AB7; Tue, 18 Sep 2018 18:49:03 +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 A01FE4A46F; Tue, 18 Sep 2018 18:49:02 +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 w8IImro8003667 for ; Tue, 18 Sep 2018 14:48:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 990EA7A437; Tue, 18 Sep 2018 18:48:53 +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 BEBDE17581; Tue, 18 Sep 2018 18:48:52 +0000 (UTC) From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 20:48:18 +0200 Message-Id: <20180918184818.17546-16-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 15/15] xen_common: Change xenParseCharDev to using virConfGetValueStringList 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.11 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:04 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Signed-off-by: Fabiano Fid=C3=AAncio --- src/xenconfig/xen_common.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c index a6e77a9250..786c276c99 100644 --- a/src/xenconfig/xen_common.c +++ b/src/xenconfig/xen_common.c @@ -759,9 +759,11 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def) static int xenParseCharDev(virConfPtr conf, virDomainDefPtr def, const char *nativeFo= rmat) { + char **serials =3D NULL; const char *str; virConfValuePtr value =3D NULL; virDomainChrDefPtr chr =3D NULL; + int ret =3D -1; =20 if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM) { if (xenConfigGetString(conf, "parallel", &str, NULL) < 0) @@ -782,7 +784,8 @@ xenParseCharDev(virConfPtr conf, virDomainDefPtr def, c= onst char *nativeFormat) =20 /* Try to get the list of values to support multiple serial ports = */ value =3D virConfGetValue(conf, "serial"); - if (value && value->type =3D=3D VIR_CONF_LIST) { + if (virConfGetValueStringList(conf, "serial", false, &serials) =3D= =3D 1) { + char **entries; int portnum =3D -1; =20 if (STREQ(nativeFormat, XEN_CONFIG_FORMAT_XM)) { @@ -791,18 +794,12 @@ xenParseCharDev(virConfPtr conf, virDomainDefPtr def,= const char *nativeFormat) goto cleanup; } =20 - value =3D value->list; - while (value) { - char *port =3D NULL; + for (entries =3D serials; *entries; entries++) { + char *port =3D *entries; =20 - if ((value->type !=3D VIR_CONF_STRING) || (value->str =3D= =3D NULL)) - goto cleanup; - port =3D value->str; portnum++; - if (STREQ(port, "none")) { - value =3D value->next; + if (STREQ(port, "none")) continue; - } =20 if (!(chr =3D xenParseSxprChar(port, NULL))) goto cleanup; @@ -827,6 +824,7 @@ xenParseCharDev(virConfPtr conf, virDomainDefPtr def, c= onst char *nativeFormat) chr->target.port =3D 0; def->serials[0] =3D chr; def->nserials++; + chr =3D NULL; } } } else { @@ -840,11 +838,12 @@ xenParseCharDev(virConfPtr conf, virDomainDefPtr def,= const char *nativeFormat) def->consoles[0]->targetType =3D VIR_DOMAIN_CHR_CONSOLE_TARGET_TYP= E_XEN; } =20 - return 0; + ret =3D 0; =20 cleanup: virDomainChrDefFree(chr); - return -1; + virStringListFree(serials); + return ret; } =20 =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list