From nobody Tue Oct 28 16:42:06 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1760966939; cv=none; d=zohomail.com; s=zohoarc; b=GGdxwLy3SE9vKAWnOlSQJA/afAADEqG5PQJMLSBOFfdL7TbrLTOAFUDu7CTOGyVXAWCdFCPy2psCSU9sM9fKK8BuhS8lYyQa3tfBdS8V0A/o06RZe1OxNol2hlrBH88faXY9WJutp1FICvC0WIg51EPAVMu3rAVtuiwKSGPI35s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1760966939; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=fg7qlMeiyk6ig8+ZU9h2D1Rz0jEUETfv7fpoeX+b4Yg=; b=CATh9ForWqgHoFz+5d2FZaLEq1h9MoUqa99EGK05oFCExeSPkMcW15VXltgDdi1n3lGDDPjgwKrNKHgHXecojVBl3oValXZyZMHKFBz82HaHotRgtMyMDHOEvjB/9oBTWiww0htoOSJOULqnOzA6wX8oOofDDsFc5rqcyIe+lIE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1760966939371616.7605573963514; Mon, 20 Oct 2025 06:28:59 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 76FF13FA30; Mon, 20 Oct 2025 09:28:56 -0400 (EDT) Received: from [172.19.199.20] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 0BAC643E74; Mon, 20 Oct 2025 09:27:57 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 656CF3FC5D; Mon, 20 Oct 2025 09:21:28 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 7359E41A66 for ; Mon, 20 Oct 2025 09:21:27 -0400 (EDT) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-573-A6UZ0gIUOCmq4mkdFcB-Tw-1; Mon, 20 Oct 2025 09:21:25 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2A6111800743 for ; Mon, 20 Oct 2025 13:21:25 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.15]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 77E0D180035A for ; Mon, 20 Oct 2025 13:21:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1760966487; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fg7qlMeiyk6ig8+ZU9h2D1Rz0jEUETfv7fpoeX+b4Yg=; b=Y+/T5ZH1t9LOYJf2jOnoRy9WaArX4n4rnGdwvDwRxPYZsgFZeiFSMUYdugYyZ7nqruVWe1 Vb7z0cfiNPJLfyurp2tvt3iLRvakf3JEwIrz64bGzfiJey/ARjki/J67B5PaxT4a9vUW9r XYLH2v18kBlMy2lkCUHo8/YO1A5vP6k= X-MC-Unique: A6UZ0gIUOCmq4mkdFcB-Tw-1 X-Mimecast-MFC-AGG-ID: A6UZ0gIUOCmq4mkdFcB-Tw_1760966485 To: devel@lists.libvirt.org Subject: [PATCH 3/3] virNetDevVlanParse: Refactor cleanup Date: Mon, 20 Oct 2025 15:21:19 +0200 Message-ID: <51c00d874289b1381dc586bafc4d1afa191f8df9.1760966455.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Jaenhg_Sooe6S0CM9TwAlYx3ge8Py0OsJihJao_juXM_1760966485 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: UJWDAKMDMO5TED4NVTE7DXIDYA2SP3FH X-Message-ID-Hash: UJWDAKMDMO5TED4NVTE7DXIDYA2SP3FH X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1760966941023158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Signed-off-by: Peter Krempa --- src/conf/netdev_vlan_conf.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/conf/netdev_vlan_conf.c b/src/conf/netdev_vlan_conf.c index 012a28034e..db142024cd 100644 --- a/src/conf/netdev_vlan_conf.c +++ b/src/conf/netdev_vlan_conf.c @@ -30,9 +30,10 @@ VIR_ENUM_IMPL(virNativeVlanMode, ); int -virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlan= *def) +virNetDevVlanParse(xmlNodePtr node, + xmlXPathContextPtr ctxt, + virNetDevVlan *def) { - int ret =3D -1; VIR_XPATH_NODE_AUTORESTORE(ctxt) g_autofree char *trunk =3D NULL; g_autofree xmlNodePtr *tagNodes =3D NULL; @@ -43,12 +44,12 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr = ctxt, virNetDevVlan *def) nTags =3D virXPathNodeSet("./tag", ctxt, &tagNodes); if (nTags < 0) - goto cleanup; + return -1; if (nTags =3D=3D 0) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing tag id - each must have at least = one subelement")); - goto cleanup; + return -1; } def->tag =3D g_new0(unsigned int, nTags); @@ -60,12 +61,12 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr = ctxt, virNetDevVlan *def) if (virXMLPropUInt(tagNodes[i], "id", 10, VIR_XML_PROP_REQUIRED, &def->tag[i]) < 0) - goto cleanup; + return -1; if (def->tag[i] > 4095) { virReportError(VIR_ERR_XML_ERROR, _("vlan tag id %1$u too large (maximum 4095)"),= def->tag[i]); - goto cleanup; + return -1; } if ((rc =3D virXMLPropEnum(tagNodes[i], "nativeMode", @@ -77,7 +78,7 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ct= xt, virNetDevVlan *def) if (def->nativeMode !=3D 0) { virReportError(VIR_ERR_XML_ERROR, "%s", _("duplicate native vlan setting")); - goto cleanup; + return -1; } def->nativeMode =3D nativeMode; @@ -101,26 +102,24 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPt= r ctxt, virNetDevVlan *def) virReportError(VIR_ERR_XML_ERROR, _("invalid \"trunk=3D'%1$s'\" in - t= runk=3D'yes' is required for more than one vlan tag"), trunk); - goto cleanup; + return -1; } if (def->nativeMode !=3D 0) { virReportError(VIR_ERR_XML_ERROR, "%s", _("invalid configuration in - \"trun= k=3D'no'\" is not allowed with a native vlan id")); - goto cleanup; + return -1; } /* allow (but discard) "trunk=3D'no' if there is a single tag = */ if (STRCASENEQ(trunk, "no")) { virReportError(VIR_ERR_XML_ERROR, _("invalid \"trunk=3D'%1$s'\" in - m= ust be yes or no"), trunk); - goto cleanup; + return -1; } } } - ret =3D 0; - cleanup: - return ret; + return 0; } int --=20 2.51.0