From nobody Wed May 15 22:13:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1621433937; cv=none; d=zohomail.com; s=zohoarc; b=GccDmlAJ5pTAz1ENLP3qs6olSAw2kHLelOb/Glc5Q2lg1DY0oqEVDCxwpQ1miZpoFeS/B23xlx6VYKBQLsUZszW+fYPyKJOEoXXTqUK8vQGQ+jx9SJFkKkGtaHTlEtWR9g+9Ixh8s+taweVysiigiGaTYAocpavuk0PPztL3vkI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621433937; 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=XXcEJuoK9aLbX/kgqZOFbSy+Zeh/o8YDwM1Y5OjZ6SA=; b=B5+/ZLKlvnvORAJO1+92Ik2sFXDQuRCS82uSCRaRcfBZb4bmIYENonfyTp2c17LtRnKe8L2QKnbPSt9OyA8BMDJsrVfXiT1V4OFt308c5aAhjRIvCnxmvzpRIY5Qf44z/2gg9iDkbZNbL4upkAAvUmydtn9NV5vsK2SfxSqC3OA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1621433937071458.69878802547623; Wed, 19 May 2021 07:18:57 -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-492-2MoezyWSPwi5L37k8J_8qg-1; Wed, 19 May 2021 10:18:50 -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 1FDC5180FD77; Wed, 19 May 2021 14:18:45 +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 F1E1F5D703; Wed, 19 May 2021 14:18: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 BAB9D59CD2; Wed, 19 May 2021 14:18:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14JEAIF3011827 for ; Wed, 19 May 2021 10:10:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1BEE81037EB3; Wed, 19 May 2021 14:10:18 +0000 (UTC) Received: from work.redhat.com (ovpn-113-53.ams2.redhat.com [10.36.113.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E4FD10013C1; Wed, 19 May 2021 14:10:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621433933; 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=XXcEJuoK9aLbX/kgqZOFbSy+Zeh/o8YDwM1Y5OjZ6SA=; b=NV45/K3HqLo286fG36WteJ2CJ9S+8RRVhaVNWow3C7EJ2TIFN+USAbxoKFKJqz8RwAu8eL 0OZ/NqIFGTcrCXQ3FgXQU0lLvrqcNVxAA+juaK8eRsaUHdGGNjz7q5kUeEDpmkCKsqUgVm LJmIU2FY+8LoHuVDELvzkuy81pViWFA= X-MC-Unique: 2MoezyWSPwi5L37k8J_8qg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 01/10] virDomainAudioPulseAudioParse: Use virXMLProp* Date: Wed, 19 May 2021 16:10:03 +0200 Message-Id: <20210519141012.125114-2-twiederh@redhat.com> In-Reply-To: <20210519141012.125114-1-twiederh@redhat.com> References: <20210519141012.125114-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This strictens the parser to disallow negative values (interpreted as `UINT_MAX + value + 1`) for attribute `latency`. Allowing negative numbers to be interpreted this way makes no sense for this attribute. Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b3ed3a9c5a..942d6f269a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13092,18 +13092,12 @@ static int virDomainAudioPulseAudioParse(virDomainAudioIOPulseAudio *def, xmlNodePtr node) { - g_autofree char *latency =3D virXMLPropString(node, "latency"); - def->name =3D virXMLPropString(node, "name"); def->streamName =3D virXMLPropString(node, "streamName"); =20 - if (latency && - virStrToLong_ui(latency, NULL, 10, - &def->latency) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("cannot parse 'latency' value '%s'"), latency); + if (virXMLPropUInt(node, "latency", 10, VIR_XML_PROP_NONE, + &def->latency) < 0) return -1; - } =20 return 0; } --=20 2.26.3 From nobody Wed May 15 22:13:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1621433812; cv=none; d=zohomail.com; s=zohoarc; b=nvkSVeoloOzxmnHLaBVNqy1c2S3fyf9Al+TlCxc/PUTEyeJUoSp/WWVpkQANHzrdcBxOrE7uUx9r8qCrylJ+kw8RiyAMDhDKZv7rJnstdlmw674BgivC4I1XJIQivAg57t6+hn+see1e4BfbTitvsjoEjl0rsdlHU0aVfSQsWFo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621433812; 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=UAXa1Jg/4oao+lalONCNLC5tTONatyQv0xQfE8Hf0F0=; b=bdJuXGt+A/0UzrfL9UbY6rWL4OFPYiqOrK2xwobOs2sy+hq7peF98fAuYdZao51IZ7U790KKYp4yUh47FLAByEUqnRIsVgRUcPFAPorNOm03XjuI2bV/zchxkSk5yAe8UHN3G6SQ3KsxbpzFQ0ECxFPkg+91Ktdx6A9UPnmqkgE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1621433812660841.7935108998485; Wed, 19 May 2021 07:16:52 -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-581-2-RANjxKOPKkaCk6zffMSw-1; Wed, 19 May 2021 10:16:47 -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 6A83E1935780; Wed, 19 May 2021 14:16:40 +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 4DC8C60917; Wed, 19 May 2021 14:16:40 +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 131EC180B464; Wed, 19 May 2021 14:16:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14JEAJ3e011835 for ; Wed, 19 May 2021 10:10:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2A8F910013C1; Wed, 19 May 2021 14:10:19 +0000 (UTC) Received: from work.redhat.com (ovpn-113-53.ams2.redhat.com [10.36.113.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7118010027C4; Wed, 19 May 2021 14:10:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621433809; 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=UAXa1Jg/4oao+lalONCNLC5tTONatyQv0xQfE8Hf0F0=; b=VSBy7j1ORMI5E6MJHNIuda6BC/KvDab7JNqOJ+x1UjeEag2Nk4gChyOk5XvymyvUY1vEsx BDpCCnvREmO/Orm/C+uvTLchgvBUv7K/gmnF568FANHxeNFzT7syJz6nrNy4Gu+dtN4Y4m bMfgQ9cSHcYMWa1Olrr4/J0f9ZAJZC8= X-MC-Unique: 2-RANjxKOPKkaCk6zffMSw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 02/10] virDomainAudioDef: Change type of "type" to virDomainAudioType Date: Wed, 19 May 2021 16:10:04 +0200 Message-Id: <20210519141012.125114-3-twiederh@redhat.com> In-Reply-To: <20210519141012.125114-1-twiederh@redhat.com> References: <20210519141012.125114-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- src/bhyve/bhyve_command.c | 2 +- src/conf/domain_conf.c | 18 ++++++++++-------- src/conf/domain_conf.h | 2 +- src/qemu/qemu_command.c | 4 ++-- src/qemu/qemu_validate.c | 2 +- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index f8e0ce5123..ab9d3026cc 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -524,7 +524,7 @@ bhyveBuildSoundArgStr(const virDomainDef *def G_GNUC_UN= USED, virCommandAddArg(cmd, "-s"); =20 if (audio) { - switch ((virDomainAudioType) audio->type) { + switch (audio->type) { case VIR_DOMAIN_AUDIO_TYPE_OSS: if (virDomainAudioIOCommonIsSet(&audio->input) || virDomainAudioIOCommonIsSet(&audio->output)) { diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 942d6f269a..758f699c2c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2922,7 +2922,7 @@ virDomainAudioDefFree(virDomainAudioDef *def) if (!def) return; =20 - switch ((virDomainAudioType) def->type) { + switch (def->type) { case VIR_DOMAIN_AUDIO_TYPE_NONE: break; =20 @@ -13123,24 +13123,26 @@ virDomainAudioDefParseXML(virDomainXMLOption *xml= opt G_GNUC_UNUSED, virDomainAudioDef *def; VIR_XPATH_NODE_AUTORESTORE(ctxt) g_autofree char *tmp =3D NULL; - g_autofree char *type =3D NULL; + g_autofree char *typestr =3D NULL; + int type; xmlNodePtr inputNode, outputNode; =20 def =3D g_new0(virDomainAudioDef, 1); ctxt->node =3D node; =20 - type =3D virXMLPropString(node, "type"); - if (!type) { + typestr =3D virXMLPropString(node, "type"); + if (!typestr) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing audio 'type' attribute")); goto error; } =20 - if ((def->type =3D virDomainAudioTypeTypeFromString(type)) < 0) { + if ((type =3D virDomainAudioTypeTypeFromString(typestr)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown audio type '%s'"), type); + _("unknown audio type '%s'"), typestr); goto error; } + def->type =3D type; =20 tmp =3D virXMLPropString(node, "id"); if (!tmp) { @@ -13163,7 +13165,7 @@ virDomainAudioDefParseXML(virDomainXMLOption *xmlop= t G_GNUC_UNUSED, if (outputNode && virDomainAudioCommonParse(&def->output, outputNode, = ctxt) < 0) goto error; =20 - switch ((virDomainAudioType) def->type) { + switch (def->type) { case VIR_DOMAIN_AUDIO_TYPE_NONE: break; =20 @@ -25465,7 +25467,7 @@ virDomainAudioDefFormat(virBuffer *buf, =20 virBufferAsprintf(buf, "