From nobody Tue Sep 9 19:05:57 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; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1737556704484932.460903248348; Wed, 22 Jan 2025 06:38:24 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id BCE7B141C; Wed, 22 Jan 2025 09:38:23 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id D33F5140D; Wed, 22 Jan 2025 09:38:04 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 78FB713F4; Wed, 22 Jan 2025 09:38:01 -0500 (EST) Received: from air.basealt.ru (air.basealt.ru [193.43.8.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id CEBF213EF for ; Wed, 22 Jan 2025 09:38:00 -0500 (EST) Received: from kuznetsovam-nb.office.basealt.ru (unknown [193.43.10.250]) (Authenticated sender: kuznetsovam) by air.basealt.ru (Postfix) with ESMTPSA id 57A3F23370; Wed, 22 Jan 2025 17:37:59 +0300 (MSK) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 From: Alexander Kuznetsov To: devel@lists.libvirt.org Subject: [PATCH] util: netdevvlan: Change return type of virNetDevVlanCopy to void Date: Wed, 22 Jan 2025 17:37:31 +0300 Message-ID: <20250122143740.36019-1-kuznetsovam@altlinux.org> X-Mailer: git-send-email 2.42.4 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 5IYRAWGT7PAGOUSC6I46FXHSGZQ5KEHM X-Message-ID-Hash: 5IYRAWGT7PAGOUSC6I46FXHSGZQ5KEHM X-MailFrom: kuznetsovam@altlinux.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: nickel@altlinux.org, egori@altlinux.org X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZM-MESSAGEID: 1737556706366019000 Content-Type: text/plain; charset="utf-8" This function return value is invariant since 1022e0ee, so change its type and remove all dependent checks. Found by Linux Verification Center (linuxtesting.org) with Svace. Reported-by: Alexander Rudyuk Signed-off-by: Alexander Kuznetsov --- src/conf/domain_conf.c | 9 +++------ src/network/bridge_driver.c | 4 +++- src/util/virnetdevvlan.c | 6 +++--- src/util/virnetdevvlan.h | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3f88a77a8f..6f49ee507a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -30533,8 +30533,7 @@ virDomainNetDefToNetworkPort(virDomainDef *dom, if (virNetDevBandwidthCopy(&port->bandwidth, iface->bandwidth) < 0) return NULL; =20 - if (virNetDevVlanCopy(&port->vlan, &iface->vlan) < 0) - return NULL; + virNetDevVlanCopy(&port->vlan, &iface->vlan); =20 port->isolatedPort =3D iface->isolatedPort; port->trustGuestRxFilters =3D iface->trustGuestRxFilters; @@ -30611,8 +30610,7 @@ virDomainNetDefActualFromNetworkPort(virDomainNetDe= f *iface, if (virNetDevBandwidthCopy(&actual->bandwidth, port->bandwidth) < 0) goto error; =20 - if (virNetDevVlanCopy(&actual->vlan, &port->vlan) < 0) - goto error; + virNetDevVlanCopy(&actual->vlan, &port->vlan); =20 actual->isolatedPort =3D port->isolatedPort; actual->class_id =3D port->class_id; @@ -30729,8 +30727,7 @@ virDomainNetDefActualToNetworkPort(virDomainDef *do= m, if (virNetDevBandwidthCopy(&port->bandwidth, actual->bandwidth) < 0) return NULL; =20 - if (virNetDevVlanCopy(&port->vlan, &actual->vlan) < 0) - return NULL; + virNetDevVlanCopy(&port->vlan, &actual->vlan); =20 port->isolatedPort =3D actual->isolatedPort; port->class_id =3D actual->class_id; diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 8f47ef2574..668870a9ee 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -3973,8 +3973,10 @@ networkAllocatePort(virNetworkObj *obj, else if (netdef->vlan.nTags > 0) vlan =3D &netdef->vlan; =20 - if (vlan && virNetDevVlanCopy(&port->vlan, vlan) < 0) + if (vlan) { + virNetDevVlanCopy(&port->vlan, vlan); return -1; + } } =20 if (!port->trustGuestRxFilters) { diff --git a/src/util/virnetdevvlan.c b/src/util/virnetdevvlan.c index 67daa5d3b4..e8f572efd2 100644 --- a/src/util/virnetdevvlan.c +++ b/src/util/virnetdevvlan.c @@ -76,11 +76,11 @@ virNetDevVlanEqual(const virNetDevVlan *a, const virNet= DevVlan *b) * If src is NULL, dst will have nTags set to 0. * dst is assumed to be empty on entry. */ -int +void virNetDevVlanCopy(virNetDevVlan *dst, const virNetDevVlan *src) { if (!src || src->nTags =3D=3D 0) - return 0; + return; =20 dst->tag =3D g_new0(unsigned int, src->nTags); dst->trunk =3D src->trunk; @@ -88,5 +88,5 @@ virNetDevVlanCopy(virNetDevVlan *dst, const virNetDevVlan= *src) dst->nativeMode =3D src->nativeMode; dst->nativeTag =3D src->nativeTag; memcpy(dst->tag, src->tag, src->nTags * sizeof(*src->tag)); - return 0; + return; } diff --git a/src/util/virnetdevvlan.h b/src/util/virnetdevvlan.h index 228d270869..fd2f8023f5 100644 --- a/src/util/virnetdevvlan.h +++ b/src/util/virnetdevvlan.h @@ -42,6 +42,6 @@ struct _virNetDevVlan { void virNetDevVlanClear(virNetDevVlan *vlan); void virNetDevVlanFree(virNetDevVlan *vlan); int virNetDevVlanEqual(const virNetDevVlan *a, const virNetDevVlan *b); -int virNetDevVlanCopy(virNetDevVlan *dst, const virNetDevVlan *src); +void virNetDevVlanCopy(virNetDevVlan *dst, const virNetDevVlan *src); =20 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetDevVlan, virNetDevVlanFree); --=20 2.42.4