From nobody Sun May 19 03:12:44 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=1571434835; cv=none; d=zoho.com; s=zohoarc; b=Akihyl2b3P4IIYCSslUQeF0u/caxsCeEGkqQm0upAFm8b8MVh+OTn4mSU7RwxC0ReAmvZeayqzo+lIHcahqedFofg3K4xicWxL8hM9m1l5SniHLTUL1V9lV5UWzEt/pUA5xhQp43FZ0ab+jrDizcvBabu6OcJQXP5zRmNFMPXqc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571434835; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2Yri9RM1jUis/v59OGEd5OQGRf12psH5l5LPkqCIhf4=; b=jKeqG5msQVJRSK5HMAoEsBTTJ8YLrN9NUcS3syPYOp3oYArRCgfzHBlUtj/jhPPOtHb0KnkV1OZ40v2LR6SFUqIfGZoMgBN2nSd6xqZA9SlyJVE1tYMktAIU60swJKXouH14A71e/3kUG6muBK9EvtpmDjgN8zvCzBCpjfvJ83E= 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 157143483504029.725810798953262; Fri, 18 Oct 2019 14:40:35 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7D36D8A1C95; Fri, 18 Oct 2019 21:40:32 +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 5E01F5D9CC; Fri, 18 Oct 2019 21:40:32 +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 028DB4EE96; Fri, 18 Oct 2019 21:40:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9ILeS3i022413 for ; Fri, 18 Oct 2019 17:40:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2F4ED5C226; Fri, 18 Oct 2019 21:40:28 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-117-200.phx2.redhat.com [10.3.117.200]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D8F385C1B5; Fri, 18 Oct 2019 21:40:27 +0000 (UTC) From: Jonathon Jongsma To: libvir-list@redhat.com Date: Fri, 18 Oct 2019 16:40:19 -0500 Message-Id: <20191018214023.25481-2-jjongsma@redhat.com> In-Reply-To: <20191018214023.25481-1-jjongsma@redhat.com> References: <20191018214023.25481-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: jcfaracco@gmail.com, crobinso@redhat.com Subject: [libvirt] [PATCH 1/5] qemu: fix documentation for video resolution 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.69]); Fri, 18 Oct 2019 21:40:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The video resolution support that was introduced in 7286279797a34b3083d85bc4556432b5e7ad9fff is specified as a sub-element of , not optional attributes of model. Signed-off-by: Jonathon Jongsma Reviewed-by: J=C3=A1n Tomko --- docs/formatdomain.html.in | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 962766b792..7cc9ada897 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -7077,10 +7077,14 @@ qemu-kvm -net nic,model=3D? /dev/null vgamem (since 1.2.11) = to set the size of VGA framebuffer for fallback mode of QXL device. Attribute vram64 (since 1.3.3= ) - extends secondary bar and makes it addressable as 64bit memory. = For - resolution settings, there are x and y - (since 5.9.0) optional attributes t= o set - minimum resolution for model. + extends secondary bar and makes it addressable as 64bit memory. +

+

Since 5.9.0, the model + element may also have an optional resolution sub-elem= ent. + The resolution element has attributes x = and + y to set the minimum resolution for the video device.= This + sub-element is valid for model types "vga", "qxl", "bochs", and + "virtio".

=20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 19 03:12:44 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=1571434843; cv=none; d=zoho.com; s=zohoarc; b=meLoZzko+geS+DPRB3ZcJd+WCU1LzNByXbtX5XTkRiKHPNu/cO6GpYG76DXA8hENKLGYOCcP0VuxXsU68zxtk4YDSwM2Ofl5dBiJBqaQYnZ8ygBKM9FUDZa0EvuY1zKkXBDAprg0dCUP0nFkxgx1nwL/NO0R2NlIqWng9MfDllA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571434843; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JWf2rG+Z7WZGC33bUmJR4zbAhZ+E5Nm8kD6Cjht2veE=; b=Sc92XBDO5qMjI5owTjYGFRN4KPCvjlnfLALuod0OKYl0gyBcD7RtT+sPw2+EjsJIgF1dPPASVbTCAJDIGOjMJVONpA0z1QuSaQEuvRyVEKYABGc82ADiQ44c1QHdASEb2OzOJ0n3np0D5EjJv39nOTLkS6bEQdTcMi74mDMilR8= 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 1571434843332183.70020998816904; Fri, 18 Oct 2019 14:40:43 -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 6A751C049E12; Fri, 18 Oct 2019 21:40:41 +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 4724E5C1B5; Fri, 18 Oct 2019 21:40:41 +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 0176E180085A; Fri, 18 Oct 2019 21:40:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9ILeSvP022418 for ; Fri, 18 Oct 2019 17:40:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 932BE5C21A; Fri, 18 Oct 2019 21:40:28 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-117-200.phx2.redhat.com [10.3.117.200]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4AC4B5C1B5; Fri, 18 Oct 2019 21:40:28 +0000 (UTC) From: Jonathon Jongsma To: libvir-list@redhat.com Date: Fri, 18 Oct 2019 16:40:20 -0500 Message-Id: <20191018214023.25481-3-jjongsma@redhat.com> In-Reply-To: <20191018214023.25481-1-jjongsma@redhat.com> References: <20191018214023.25481-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: jcfaracco@gmail.com, crobinso@redhat.com Subject: [libvirt] [PATCH 2/5] conf: Return error when resolution values are invalid 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 18 Oct 2019 21:40:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Report an error and return NULL when either the 'x' or 'y' resolution values cannot be converted to unsigned integers rather than returning the incomplete 'def' variable. Switch 'def' to an autofree variable to simplify the logic and remove the goto. Signed-off-by: Jonathon Jongsma --- src/conf/domain_conf.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 88e93f6fb8..5657faf039 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15349,7 +15349,7 @@ static virDomainVideoResolutionDefPtr virDomainVideoResolutionDefParseXML(xmlNodePtr node) { xmlNodePtr cur; - virDomainVideoResolutionDefPtr def; + g_autofree virDomainVideoResolutionDefPtr def =3D NULL; g_autofree char *x =3D NULL; g_autofree char *y =3D NULL; =20 @@ -15368,14 +15368,13 @@ virDomainVideoResolutionDefParseXML(xmlNodePtr no= de) if (!x || !y) return NULL; =20 - if (VIR_ALLOC(def) < 0) - goto cleanup; + def =3D g_new0(virDomainVideoResolutionDef, 1); =20 if (x) { if (virStrToLong_uip(x, NULL, 10, &def->x) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("cannot parse video x-resolution '%s'"), x); - goto cleanup; + return NULL; } } =20 @@ -15383,12 +15382,11 @@ virDomainVideoResolutionDefParseXML(xmlNodePtr no= de) if (virStrToLong_uip(y, NULL, 10, &def->y) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("cannot parse video y-resolution '%s'"), y); - goto cleanup; + return NULL; } } =20 - cleanup: - return def; + return g_steal_pointer(&def); } =20 static virDomainVideoDriverDefPtr --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 19 03:12:44 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=1571434846; cv=none; d=zoho.com; s=zohoarc; b=mYPyNqhlZCj7x/lTgs1hOlttsael+QK6MxLZGTXoGlh0Yi4kHiCa6A5uoGKXoMsrb/S75MBpa/8gzheumfYtMHbUXgXjOfHGW2aggZc0C6oHm4vUvjDZ2FAeVAwO0OKYVxfX6AYB78CuYVcujHW1MgGcAqP/YrmOJ4BEUvaaNWQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571434846; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7X8fubwIbJV7PCp3jjN4xLmIsz0i7baGKKeACtcvLQ4=; b=Su2YEtg77mEd3n3cscP/D/MkSsqre/XEYuAJkQSU433+8pqzvizAx82TWG/UkDPvxM5kzyxrsR4grcAw20OMe4CLZWXU+VIItax5ptKP5pujtADz3wfRZa4yCalz/Cr3TlK+2+OwvXR3xQC7nxPbNYPTtGpdqoNtwi15FkZqe5w= 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 1571434846670581.0861584368647; Fri, 18 Oct 2019 14:40:46 -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 F17DE18CCEE3; Fri, 18 Oct 2019 21:40:44 +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 C74E07E2E; Fri, 18 Oct 2019 21:40:44 +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 806F44EE97; Fri, 18 Oct 2019 21:40:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9ILeVNr022434 for ; Fri, 18 Oct 2019 17:40:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 76FA05C226; Fri, 18 Oct 2019 21:40:31 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-117-200.phx2.redhat.com [10.3.117.200]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D3785C1B5; Fri, 18 Oct 2019 21:40:28 +0000 (UTC) From: Jonathon Jongsma To: libvir-list@redhat.com Date: Fri, 18 Oct 2019 16:40:21 -0500 Message-Id: <20191018214023.25481-4-jjongsma@redhat.com> In-Reply-To: <20191018214023.25481-1-jjongsma@redhat.com> References: <20191018214023.25481-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: jcfaracco@gmail.com, crobinso@redhat.com Subject: [libvirt] [PATCH 3/5] conf: remove unnecessary NULL checks 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Fri, 18 Oct 2019 21:40:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Just above in the function, we return from the function if either x or y are NULL, so there's no need to re-check whether x or y are NULL. Signed-off-by: Jonathon Jongsma --- src/conf/domain_conf.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5657faf039..a446ce4d62 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15370,20 +15370,16 @@ virDomainVideoResolutionDefParseXML(xmlNodePtr no= de) =20 def =3D g_new0(virDomainVideoResolutionDef, 1); =20 - if (x) { - if (virStrToLong_uip(x, NULL, 10, &def->x) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("cannot parse video x-resolution '%s'"), x); - return NULL; - } + if (virStrToLong_uip(x, NULL, 10, &def->x) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("cannot parse video x-resolution '%s'"), x); + return NULL; } =20 - if (y) { - if (virStrToLong_uip(y, NULL, 10, &def->y) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("cannot parse video y-resolution '%s'"), y); - return NULL; - } + if (virStrToLong_uip(y, NULL, 10, &def->y) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("cannot parse video y-resolution '%s'"), y); + return NULL; } =20 return g_steal_pointer(&def); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 19 03:12:44 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=1571434850; cv=none; d=zoho.com; s=zohoarc; b=ax6Z1tyM7oK2Si7lVLEDh6y2+guPVmnKGnkfuwBIIQQZQ79j33qaxL+dWf8LFLPaJHUW4lsqmF/vTnaz1osDIPGhT/xRltmfSE+jRBcL/IZYpjKeL119saTABi2Qmbh2WPvwDZewndUNt1bwkdsRt6JFwyS/bBzdc5frSUMy+R4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571434850; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ma8ontVVn0H9C1kYgSNiZEmtZPCGo8sEuevlRax+v3s=; b=MRdW22d7N6z6gXv/1V9HwN1qlwBNbPa1g7Yw5fGuNlAdhntSY5KmJE4ZaNeGSgnpZHyAXd0XjtGC7ztF3UabQoMO/TIg38lxiji8ZcFyPoNBXYzosTi5i6ocSUf9b9ShSehfFDXGsm4uJV1iSum43XZmhfcXxDfFLSvR3aNaQks= 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 1571434850068934.0452947135088; Fri, 18 Oct 2019 14:40:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 45B8030860D7; Fri, 18 Oct 2019 21:40:48 +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 21CDD5DA8C; Fri, 18 Oct 2019 21:40:48 +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 D3F334EEBA; Fri, 18 Oct 2019 21:40:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9ILeVgr022440 for ; Fri, 18 Oct 2019 17:40:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id DA2725C226; Fri, 18 Oct 2019 21:40:31 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-117-200.phx2.redhat.com [10.3.117.200]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 91B065C1B5; Fri, 18 Oct 2019 21:40:31 +0000 (UTC) From: Jonathon Jongsma To: libvir-list@redhat.com Date: Fri, 18 Oct 2019 16:40:22 -0500 Message-Id: <20191018214023.25481-5-jjongsma@redhat.com> In-Reply-To: <20191018214023.25481-1-jjongsma@redhat.com> References: <20191018214023.25481-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: jcfaracco@gmail.com, crobinso@redhat.com Subject: [libvirt] [PATCH 4/5] conf: ensure both resolution values are non-zero 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 18 Oct 2019 21:40:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Since the users of the resolution expect the x and y values to be non-zero, enforce it in the parser and report an error if either is zero. Signed-off-by: Jonathon Jongsma --- src/conf/domain_conf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a446ce4d62..38f8b37b69 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15382,6 +15382,12 @@ virDomainVideoResolutionDefParseXML(xmlNodePtr nod= e) return NULL; } =20 + if (def->x =3D=3D 0 || def->y =3D=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("resolution values must be greater than 0")); + return NULL; + } + return g_steal_pointer(&def); } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 19 03:12:44 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=1571434843; cv=none; d=zoho.com; s=zohoarc; b=MrCqhu9CSL/Q+/gftj7Cm3VEzNhHK5WAU6sXUkVmlblqVbRsZtEQSo0sJM3UUR3F5NioNa1lw7uf+OwbYSYxYPqISEDPCFeuGDPLrphjS81Htet4gp0C0VuWm6ANAyFHLsg3DoMNFichMQUXjoi8TbardF/jMzr0gzdxq+Ty9gg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571434843; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+R/ZVVQmZsT4ovWenGH3pVvWoKMl6zFpKOHmmSLJvv4=; b=jvzNVwuaT/xcPKRe+NU+mOZ1d7f2FhTuX0POkDxzA3MTiq8SmCQc8iaA6SGGmyBeR65Q3XyhQ/luRgp8oHdeECm7a1km7N+F3So7UHaCX+pXrSPgHgEOrUTdwUl4s2czpflEVYnaHUuZdV78O4YHjf70KGnD+5rDQWDv0J8i5NE= 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 15714348435061021.7844705319375; Fri, 18 Oct 2019 14:40:43 -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 952EB315C030; Fri, 18 Oct 2019 21:40:41 +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 6452160C5D; Fri, 18 Oct 2019 21:40:41 +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 1DC081808878; Fri, 18 Oct 2019 21:40:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9ILeWaj022450 for ; Fri, 18 Oct 2019 17:40:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4B5185C226; Fri, 18 Oct 2019 21:40:32 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-117-200.phx2.redhat.com [10.3.117.200]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 015B95C1B5; Fri, 18 Oct 2019 21:40:31 +0000 (UTC) From: Jonathon Jongsma To: libvir-list@redhat.com Date: Fri, 18 Oct 2019 16:40:23 -0500 Message-Id: <20191018214023.25481-6-jjongsma@redhat.com> In-Reply-To: <20191018214023.25481-1-jjongsma@redhat.com> References: <20191018214023.25481-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: jcfaracco@gmail.com, crobinso@redhat.com Subject: [libvirt] [PATCH 5/5] conf: report errors when parsing video accel 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 18 Oct 2019 21:40:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" If any of the values are invalid, report an error and return NULL rather than returning a partially-specified accel object. Convert to g_autofree as well to simplify logic and remove the goto. Signed-off-by: Jonathon Jongsma --- src/conf/domain_conf.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 38f8b37b69..aa8a38a849 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15295,7 +15295,7 @@ static virDomainVideoAccelDefPtr virDomainVideoAccelDefParseXML(xmlNodePtr node) { xmlNodePtr cur; - virDomainVideoAccelDefPtr def; + g_autofree virDomainVideoAccelDefPtr def =3D NULL; int val; g_autofree char *accel2d =3D NULL; g_autofree char *accel3d =3D NULL; @@ -15317,14 +15317,13 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node) if (!accel3d && !accel2d && !rendernode) return NULL; =20 - if (VIR_ALLOC(def) < 0) - goto cleanup; + def =3D g_new0(virDomainVideoAccelDef, 1); =20 if (accel3d) { if ((val =3D virTristateBoolTypeFromString(accel3d)) <=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown accel3d value '%s'"), accel3d); - goto cleanup; + return NULL; } def->accel3d =3D val; } @@ -15333,7 +15332,7 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node) if ((val =3D virTristateBoolTypeFromString(accel2d)) <=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown accel2d value '%s'"), accel2d); - goto cleanup; + return NULL; } def->accel2d =3D val; } @@ -15341,8 +15340,7 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node) if (rendernode) def->rendernode =3D virFileSanitizePath(rendernode); =20 - cleanup: - return def; + return g_steal_pointer(&def); } =20 static virDomainVideoResolutionDefPtr --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list