From nobody Sat Feb 7 07:31:33 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 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