From nobody Fri Apr 26 09:36:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 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=1571852844; cv=none; d=zoho.com; s=zohoarc; b=YDrVSXQRc/bOZfP9OD+QJHDen518ZPEza9cvewMt1oBCW6uZMQVEFCf2YsNMCc/JfDvnMTAkNS+ouBhY6HOSRQj9N9rmUIHO8np94LqADo2dxRCiAKV8AqN8AqcRqe7oYi3G4ybLI7qwu8rdUQH6yd8gLc3W0oJKf8UUw//BAL0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571852844; 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=mSIX717WApJAgfzy7tQjzZWCO/OY3XyOrDg+A8m3a7E=; b=aS6xwYdbHkPWTGo7s87RkPvjF3oJXLkvk+BLCFC1J2P7i5mJEu6sbT0RIvGUQFkxVkz/fwnzCPLqYLJ+KF6ckdH7PK0KsGwf5OgekviA7Je8TSOcqiM7wCnPp4CCnEY5jjGY0zX6jWl4IyRu2Chvg4oGOqGaS+6vePcv4qlcy9Y= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1571852844974297.81897137663213; Wed, 23 Oct 2019 10:47:24 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-94-nzTj4TzYOImrYfMfILx9yg-1; Wed, 23 Oct 2019 13:47:21 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 96D3A5E4; Wed, 23 Oct 2019 17:47:16 +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 6B89F60BF1; Wed, 23 Oct 2019 17:47:16 +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 22BCB180B761; Wed, 23 Oct 2019 17:47:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9NHkrA2008823 for ; Wed, 23 Oct 2019 13:46:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id AD5BF60624; Wed, 23 Oct 2019 17:46:53 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-117-228.phx2.redhat.com [10.3.117.228]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 64F836061E; Wed, 23 Oct 2019 17:46:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571852843; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=mSIX717WApJAgfzy7tQjzZWCO/OY3XyOrDg+A8m3a7E=; b=VuhwHNsJ08zVBOy8Xqg0wEtsRd1yOmOnaPKJxFmUrfxdRlgUKLw9dPB0FNeH742hyT7f8n V/1RQ2g4otxHG+kjnC9RNx6Eu+1VotN6D3rwWZYLpEAiy8eeRJBD+DKDNOL2zhMTgNAs5/ S3nJJfQf7XPnDjubCXZl/vU6gKzQibc= From: Jonathon Jongsma To: libvir-list@redhat.com Date: Wed, 23 Oct 2019 12:46:45 -0500 Message-Id: <20191023174649.28887-2-jjongsma@redhat.com> In-Reply-To: <20191023174649.28887-1-jjongsma@redhat.com> References: <20191023174649.28887-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: jtomko@redhat.com, crobinso@redhat.com Subject: [libvirt] [PATCH v2 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: , 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-MC-Unique: nzTj4TzYOImrYfMfILx9yg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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 --- 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 Fri Apr 26 09:36:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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=1571852847; cv=none; d=zoho.com; s=zohoarc; b=WrJ1/zkmsokO6IyRSElm9TVVdiWw2uR5+pMLOxUebfPZ8QxzhqLY/kYecL47xlfY97CqwUtHgVHsKSsLvEOtOnn/fWsOKejz6aBg4xWAEkChefTyA9oWO8cvuGM384Xlmb21q//XM79eyxsZoK8fD7Uule1HoWPVKv1U6V3tsaE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571852847; 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=Aas/q+HHvz8nGVJFInPhkY2w6d6ijNFy4fii3S/IEnE=; b=ZJEyqLsyA/PAaf+CJOCt3mP7uIBVwROf0sLtPsfIb0Tf37mRbOlacX2EM3rhu6kkT+bZ0YjcOQUcixRzDJh3E8KkGqTjpn7C4E0AgOkJtu0rh8Oy9lpaFuKTgYe9GKnfvY2AB2QoPfqKP3nTw/QV9DPJ5Gga6mma4sTfNC9bYdQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1571852847750282.77410835062756; Wed, 23 Oct 2019 10:47:27 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-216-rIXtGkB2PC6uW_qrFfEsIw-1; Wed, 23 Oct 2019 13:47:25 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8AF26801E66; Wed, 23 Oct 2019 17:47:20 +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 643A860624; Wed, 23 Oct 2019 17:47:20 +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 1596E4EBC7; Wed, 23 Oct 2019 17:47:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9NHks5a008828 for ; Wed, 23 Oct 2019 13:46:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1E0F260629; Wed, 23 Oct 2019 17:46:54 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-117-228.phx2.redhat.com [10.3.117.228]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CA1A16061E; Wed, 23 Oct 2019 17:46:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571852846; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Aas/q+HHvz8nGVJFInPhkY2w6d6ijNFy4fii3S/IEnE=; b=ILyw0rt3hwaq3kCgoorx5FEU5o0/Iq7GsbNZUVohlcdMRuHx5DNRT/SojNiwrvfk+jNFfo e2baLvgrR02FVvhfHhL1USJ8W0iEBmshL7xKqs/UzCqDpzjugqpFg8tkB/MgJF2DyvY9Pb X+GMhf3EBvvPAsmo6AXLq9OBxOW9Gz8= From: Jonathon Jongsma To: libvir-list@redhat.com Date: Wed, 23 Oct 2019 12:46:46 -0500 Message-Id: <20191023174649.28887-3-jjongsma@redhat.com> In-Reply-To: <20191023174649.28887-1-jjongsma@redhat.com> References: <20191023174649.28887-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: jtomko@redhat.com, crobinso@redhat.com Subject: [libvirt] [PATCH v2 2/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: , 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-MC-Unique: rIXtGkB2PC6uW_qrFfEsIw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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 9ee9b44a5e..ad1d3ffea6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15365,20 +15365,16 @@ virDomainVideoResolutionDefParseXML(xmlNodePtr no= de) if (VIR_ALLOC(def) < 0) goto cleanup; =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; - } + if (virStrToLong_uip(x, NULL, 10, &def->x) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("cannot parse video x-resolution '%s'"), x); + goto cleanup; } =20 - if (y) { - if (virStrToLong_uip(y, NULL, 10, &def->y) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("cannot parse video y-resolution '%s'"), y); - goto cleanup; - } + if (virStrToLong_uip(y, NULL, 10, &def->y) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("cannot parse video y-resolution '%s'"), y); + goto cleanup; } =20 cleanup: --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 09:36:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 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=1571852828; cv=none; d=zoho.com; s=zohoarc; b=Gd0nZWQDMLSfBlyOuXHsmd7k/kmTmVyz8fgcMjMPB/U9NpWg/bv8iJ7t+aBYF5D2E7KHiFAwbJHmrMrVEojgXi3O17STwQwYNpfuymFBVlBLzeeMJJJhNQ9NdoGU/PJW6NBVwYHa3tIScrVwP3uYiYnQrs0QK4DoDqyo7upWpZg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571852828; 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=wxvn2wkVIPVGhv3uzsLmq0a0GHT7be6JV0lvL2A//UU=; b=He8dyEEQVpwSZwyQrTIdyI/yYNXv4GAWInroIPYXFOoCpWGYA2IEBJF2vCwJ998VYp3kmWYj7g/l2hjdlkeUzwGjTDoV0Dacjb767AA357KNhVKeS2XBfxg/pL0sGOylUrtK6cwDILkGOhurU/EnMQb/YO9gVH1VWYZlVSPC6DE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1571852828481496.0223771548689; Wed, 23 Oct 2019 10:47:08 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-359-OFsVYpGmOJaY5cEC_nVFmQ-1; Wed, 23 Oct 2019 13:47:05 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id A8503800D49; Wed, 23 Oct 2019 17:47:00 +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 6BF335D6D0; Wed, 23 Oct 2019 17:47: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 2ABAE4E58C; Wed, 23 Oct 2019 17:46:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9NHksbj008833 for ; Wed, 23 Oct 2019 13:46:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 80E2D60629; Wed, 23 Oct 2019 17:46:54 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-117-228.phx2.redhat.com [10.3.117.228]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 396606061E; Wed, 23 Oct 2019 17:46:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571852827; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=wxvn2wkVIPVGhv3uzsLmq0a0GHT7be6JV0lvL2A//UU=; b=JP65kvuISNi+xdFoWQwE33/GLA0BjDmVQYMduzRxKkTDdqw31l/vpS+5ngxiqTN6tpyJQh IbjU/kGBTvCyItQHJyF5KR47zlsI6OZZAZ23p7u4kLULmFe3cYUCM/8MCbrOgQwrIFjdwQ p18pHs9gtmkN29ZopKBn2avwpAVvU/s= From: Jonathon Jongsma To: libvir-list@redhat.com Date: Wed, 23 Oct 2019 12:46:47 -0500 Message-Id: <20191023174649.28887-4-jjongsma@redhat.com> In-Reply-To: <20191023174649.28887-1-jjongsma@redhat.com> References: <20191023174649.28887-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: jtomko@redhat.com, crobinso@redhat.com Subject: [libvirt] [PATCH v2 3/5] conf: use glib allocation when parsing video props 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: , 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-MC-Unique: OFsVYpGmOJaY5cEC_nVFmQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In preparation for some other improvements, switch to using glib allocation and g_autofree when parsing the 'acceleration' and 'resolution' properties of the video device. Signed-off-by: Jonathon Jongsma --- src/conf/domain_conf.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ad1d3ffea6..269a6ec2c3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15289,7 +15289,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; @@ -15311,8 +15311,7 @@ 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) { @@ -15336,14 +15335,14 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node) def->rendernode =3D virFileSanitizePath(rendernode); =20 cleanup: - return def; + return g_steal_pointer(&def); } =20 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 @@ -15362,8 +15361,7 @@ virDomainVideoResolutionDefParseXML(xmlNodePtr node) if (!x || !y) return NULL; =20 - if (VIR_ALLOC(def) < 0) - goto cleanup; + def =3D g_new0(virDomainVideoResolutionDef, 1); =20 if (virStrToLong_uip(x, NULL, 10, &def->x) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -15378,7 +15376,7 @@ virDomainVideoResolutionDefParseXML(xmlNodePtr node) } =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 Fri Apr 26 09:36:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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=1571852829; cv=none; d=zoho.com; s=zohoarc; b=YEu62poaH50YzSg2lbwp4PhswMbI/3vhzwjHhkLMyBy+ok4TgpjEjkFQeiRHYGFP6cDMCN4iuHf/n3pNZG+NNjKGpvMStjwlXZP/uLEcN7YXzXd3bmN7T+6Fn9YYIeQvZo4ezkpbHPBqIYYBll2iBwI7K4XjpsLZQ0ZUpSHseHM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571852829; 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=3SfG+KFYHXb31FOhQXWBFz7iPmSZy54Zq0hJATgya/M=; b=DXaJavpKHORiGuEAj4bhwdvARQaZcpxaxZWkfXN1HH9zf5NPgu6ImRIXid9giPC3YrOZxaaf+Dd+CFr7+MfikKRjHD2Sb5DzL9TECAF/4iMGg1hMjmCYCPV0gUdDAx5Wh0wVTnRKnO4Ggy0oHwPcs5BTK/B+Okz2RBVVVc2Py6w= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1571852829012182.46538805421062; Wed, 23 Oct 2019 10:47:09 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-116-S7ILq9P7NKe6-WR51Xyozw-1; Wed, 23 Oct 2019 13:47:05 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id AE65B47B; Wed, 23 Oct 2019 17:47:00 +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 873C110018FF; Wed, 23 Oct 2019 17:47: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 026D31803B4B; Wed, 23 Oct 2019 17:46:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9NHkswK008841 for ; Wed, 23 Oct 2019 13:46:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id E4A5F60624; Wed, 23 Oct 2019 17:46:54 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-117-228.phx2.redhat.com [10.3.117.228]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9CB116061E; Wed, 23 Oct 2019 17:46:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571852827; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=3SfG+KFYHXb31FOhQXWBFz7iPmSZy54Zq0hJATgya/M=; b=H1oL8M+ZOsUUw4UjUdcAecaLUtJWOFQxhypXpMCmTjxZ+F8f+IEV5EOWZmzH1TSf3n0jaq C82oHb3agEznglSfYRQJC6lQl6RYZOLPemVL++etLLzoKP73WX4cxoXTEGJkmVSMHxvuKd UMpskBCuEkCaXWPZGYCUlgluT0p1BPg= From: Jonathon Jongsma To: libvir-list@redhat.com Date: Wed, 23 Oct 2019 12:46:48 -0500 Message-Id: <20191023174649.28887-5-jjongsma@redhat.com> In-Reply-To: <20191023174649.28887-1-jjongsma@redhat.com> References: <20191023174649.28887-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: jtomko@redhat.com, crobinso@redhat.com Subject: [libvirt] [PATCH v2 4/5] conf: report errors when parsing 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: , 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-MC-Unique: S7ILq9P7NKe6-WR51Xyozw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The current code doesn't properly handle errors when parsing a video device's resolution. This patch changes the parse function signature to return an error when we're missing an 'x' or 'y' parameter or when the 'x' or 'y' parameters are not positive integers. No error is returned when no 'resolution' element is found. Previously we were returning a NULL structure for the case where 'x' or 'y' were missing, but were returning an under-specified structure for the other error cases. Signed-off-by: Jonathon Jongsma --- src/conf/domain_conf.c | 44 ++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 269a6ec2c3..b3f32d0b63 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15338,45 +15338,57 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node) return g_steal_pointer(&def); } =20 -static virDomainVideoResolutionDefPtr -virDomainVideoResolutionDefParseXML(xmlNodePtr node) +static int +virDomainVideoResolutionDefParseXML(xmlNodePtr node, + virDomainVideoResolutionDefPtr *res) { xmlNodePtr cur; g_autofree virDomainVideoResolutionDefPtr def =3D NULL; g_autofree char *x =3D NULL; g_autofree char *y =3D NULL; =20 + *res =3D NULL; cur =3D node->children; while (cur !=3D NULL) { - if (cur->type =3D=3D XML_ELEMENT_NODE) { - if (!x && !y && - virXMLNodeNameEqual(cur, "resolution")) { - x =3D virXMLPropString(cur, "x"); - y =3D virXMLPropString(cur, "y"); - } + if ((cur->type =3D=3D XML_ELEMENT_NODE) && + virXMLNodeNameEqual(cur, "resolution")) { + x =3D virXMLPropString(cur, "x"); + y =3D virXMLPropString(cur, "y"); + break; } cur =3D cur->next; } =20 + /* resolution not specified */ + if (cur =3D=3D NULL) + return 0; + + /* resolution specified, but x or y is missing. report error */ if (!x || !y) - return NULL; + return -1; =20 def =3D g_new0(virDomainVideoResolutionDef, 1); =20 if (virStrToLong_uip(x, NULL, 10, &def->x) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("cannot parse video x-resolution '%s'"), x); - goto cleanup; + return -1; } =20 if (virStrToLong_uip(y, NULL, 10, &def->y) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("cannot parse video y-resolution '%s'"), y); - goto cleanup; + return -1; } =20 - cleanup: - return g_steal_pointer(&def); + 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 -1; + } + + *res =3D g_steal_pointer(&def); + return 0; } =20 static virDomainVideoDriverDefPtr @@ -15458,7 +15470,11 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xm= lopt, } =20 def->accel =3D virDomainVideoAccelDefParseXML(cur); - def->res =3D virDomainVideoResolutionDefParseXML(cur); + if (virDomainVideoResolutionDefParseXML(cur, &def->res) < = 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("Cannot parse video resolution"= )); + goto error; + } } if (virXMLNodeNameEqual(cur, "driver")) { if (virDomainVirtioOptionsParseXML(cur, &def->virtio) < 0) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 09:36:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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=1571852854; cv=none; d=zoho.com; s=zohoarc; b=E+9TgPuSju2Ib8jtx6Bzef1WDiiYmGD2CX56syywQB8vtlGyPYSr2oXDoZrN3/327DOr3rk5Yvn48JY1W0CLBEkLin/k7E+GiHKqs/MoTaQv22EhZIOrpjoqn02jvYuKbfmFfTkVQXDsDpxfk4vojApxdTzxKW2OE8/fxQnT2TA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571852854; 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=x732BT/zKVfPMn46eZfnkxUHajHDApLwUkoC1aGxwZk=; b=npUeJy2dyxmu7bVvJjPNlRPfeC0PqGDPc9FwZ1D8VClg/gFQePgbbtqgM5tYr70yTurVEVAFjOj2NYlH59SkHsq1gnPd3KYvhanBBXH1TBDrHpUj07TfzRlxfrUsdkv3aZAYilLGRB/cOn/axRWDva1tXr04h28e5CQNT0lD/rA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1571852854715492.05944973119904; Wed, 23 Oct 2019 10:47:34 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-350-vdcVMIdyOYOLsTvB-vDj2g-1; Wed, 23 Oct 2019 13:47:31 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 314C45E9; Wed, 23 Oct 2019 17:47:24 +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 0B13710027C3; Wed, 23 Oct 2019 17:47:24 +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 BA19D180B536; Wed, 23 Oct 2019 17:47:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9NHkt50008846 for ; Wed, 23 Oct 2019 13:46:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 530D26061E; Wed, 23 Oct 2019 17:46:55 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-117-228.phx2.redhat.com [10.3.117.228]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0B05260624; Wed, 23 Oct 2019 17:46:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571852853; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=x732BT/zKVfPMn46eZfnkxUHajHDApLwUkoC1aGxwZk=; b=dDO/XP7/S3uJ+jRwrFE9ivigcQ6tmBMWkqkV/2yLnbosQ9CX+Z4CaAtZTQbt3Ll4cUL0l7 DyWKxvI1rI3Ms7lTmMEd+8K65Vj9QDI1J58XJ6nElzsvmoPoH+OIW5AW5XJ3fqOc5loxts pFc81tMZyhv3N0bscwl2Gp+V1eACUjk= From: Jonathon Jongsma To: libvir-list@redhat.com Date: Wed, 23 Oct 2019 12:46:49 -0500 Message-Id: <20191023174649.28887-6-jjongsma@redhat.com> In-Reply-To: <20191023174649.28887-1-jjongsma@redhat.com> References: <20191023174649.28887-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: jtomko@redhat.com, crobinso@redhat.com Subject: [libvirt] [PATCH v2 5/5] conf: report errors when parsing video acceleration 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: , 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-MC-Unique: vdcVMIdyOYOLsTvB-vDj2g-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In order to differentiate between a configuration that does not specify any video acceleration and one that is incorrectly specified, change the signature of virDomainVideoAccelDefParseXML() to return an error response. If any of the values are invalid, report an error rather than returning a partially-specified accel object. If no 'acceleration' node is found, do not report an error since it is optional. Signed-off-by: Jonathon Jongsma --- src/conf/domain_conf.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b3f32d0b63..1c3fc5c4ce 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15285,8 +15285,8 @@ virDomainVideoDefaultType(const virDomainDef *def) } } =20 -static virDomainVideoAccelDefPtr -virDomainVideoAccelDefParseXML(xmlNodePtr node) +static int +virDomainVideoAccelDefParseXML(xmlNodePtr node, virDomainVideoAccelDefPtr = *accel) { xmlNodePtr cur; g_autofree virDomainVideoAccelDefPtr def =3D NULL; @@ -15295,21 +15295,25 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node) g_autofree char *accel3d =3D NULL; g_autofree char *rendernode =3D NULL; =20 + *accel =3D NULL; cur =3D node->children; while (cur !=3D NULL) { - if (cur->type =3D=3D XML_ELEMENT_NODE) { - if (!accel3d && !accel2d && - virXMLNodeNameEqual(cur, "acceleration")) { - accel3d =3D virXMLPropString(cur, "accel3d"); - accel2d =3D virXMLPropString(cur, "accel2d"); - rendernode =3D virXMLPropString(cur, "rendernode"); - } + if ((cur->type =3D=3D XML_ELEMENT_NODE) && + virXMLNodeNameEqual(cur, "acceleration")) { + accel3d =3D virXMLPropString(cur, "accel3d"); + accel2d =3D virXMLPropString(cur, "accel2d"); + rendernode =3D virXMLPropString(cur, "rendernode"); + break; } cur =3D cur->next; } =20 + /* no acceleration node was specified */ + if (cur =3D=3D NULL) + return 0; + if (!accel3d && !accel2d && !rendernode) - return NULL; + return -1; =20 def =3D g_new0(virDomainVideoAccelDef, 1); =20 @@ -15317,7 +15321,7 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node) if ((val =3D virTristateBoolTypeFromString(accel3d)) <=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown accel3d value '%s'"), accel3d); - goto cleanup; + return -1; } def->accel3d =3D val; } @@ -15326,7 +15330,7 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node) if ((val =3D virTristateBoolTypeFromString(accel2d)) <=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown accel2d value '%s'"), accel2d); - goto cleanup; + return -1; } def->accel2d =3D val; } @@ -15334,8 +15338,8 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node) if (rendernode) def->rendernode =3D virFileSanitizePath(rendernode); =20 - cleanup: - return g_steal_pointer(&def); + *accel =3D g_steal_pointer(&def); + return 0; } =20 static int @@ -15469,7 +15473,11 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xm= lopt, VIR_FREE(primary); } =20 - def->accel =3D virDomainVideoAccelDefParseXML(cur); + if (virDomainVideoAccelDefParseXML(cur, &def->accel) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("Cannot parse video acceleratio= n")); + goto error; + } if (virDomainVideoResolutionDefParseXML(cur, &def->res) < = 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Cannot parse video resolution"= )); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list