From nobody Sun Dec 22 08:29:11 2024 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 1732807747075860.7330279883388; Thu, 28 Nov 2024 07:29:07 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 68A6617AF; Thu, 28 Nov 2024 10:29:06 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 5AADE1CC7; Thu, 28 Nov 2024 10:27:30 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 5BB7F1C1C; Thu, 28 Nov 2024 10:23:00 -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 CDABF17D6 for ; Thu, 28 Nov 2024 10:22:59 -0500 (EST) Received: from kuznetsovam-nb.office.basealt.ru (unknown [193.43.10.250]) by air.basealt.ru (Postfix) with ESMTPSA id B2F4823418; Thu, 28 Nov 2024 18:22:58 +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 v2 4/6] rpc: Change return type of virNetClientAddStream to void Date: Thu, 28 Nov 2024 18:21:20 +0300 Message-ID: <20241128152222.50660-5-kuznetsovam@altlinux.org> X-Mailer: git-send-email 2.42.2 In-Reply-To: <20241128152222.50660-1-kuznetsovam@altlinux.org> References: <20241128152222.50660-1-kuznetsovam@altlinux.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-MailFrom: kuznetsovam@altlinux.org X-Mailman-Rule-Hits: nonmember-moderation 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 Message-ID-Hash: J7FV3NCHCYY7GIRG2V4AXH2MSSJ3ZZAY X-Message-ID-Hash: J7FV3NCHCYY7GIRG2V4AXH2MSSJ3ZZAY X-Mailman-Approved-At: Thu, 28 Nov 2024 15:27:19 -0500 CC: nickel@altlinux.org, egori@altlinux.org, pkrempa@redhat.com 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: 1732807747703019100 Content-Type: text/plain; charset="utf-8" This function return value is invariant since VIR_EXPAND_N check removal in 7d2fd6e, so change its type and remove all dependent checks. Found by Linux Verification Center (linuxtesting.org) with Svace. Reported-by: Pavel Nekrasov Signed-off-by: Alexander Kuznetsov Reviewed-by: Jiri Denemark --- src/remote/remote_driver.c | 10 ++-------- src/rpc/gendispatch.pl | 5 +---- src/rpc/virnetclient.c | 3 +-- src/rpc/virnetclient.h | 2 +- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 4a16b8ef1d..307f9ca945 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -5663,10 +5663,7 @@ remoteDomainMigratePrepareTunnel3(virConnectPtr dcon= n, false))) return -1; =20 - if (virNetClientAddStream(priv->client, netst) < 0) { - virObjectUnref(netst); - return -1; - } + virNetClientAddStream(priv->client, netst); =20 st->driver =3D &remoteStreamDrv; st->privateData =3D netst; @@ -6432,10 +6429,7 @@ remoteDomainMigratePrepareTunnel3Params(virConnectPt= r dconn, false))) goto cleanup; =20 - if (virNetClientAddStream(priv->client, netst) < 0) { - virObjectUnref(netst); - goto cleanup; - } + virNetClientAddStream(priv->client, netst); =20 st->driver =3D &remoteStreamDrv; st->privateData =3D netst; diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index c5842dc796..724a6aed6e 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -1822,10 +1822,7 @@ elsif ($mode eq "client") { print " if (!(netst =3D virNetClientStreamNew(priv->remoteP= rogram, $call->{constname}, priv->counter, sparse)))\n"; print " goto cleanup;\n"; print "\n"; - print " if (virNetClientAddStream(priv->client, netst) < 0)= {\n"; - print " virObjectUnref(netst);\n"; - print " goto cleanup;\n"; - print " }"; + print " virNetClientAddStream(priv->client, netst);\n"; print "\n"; print " st->driver =3D &remoteStreamDrv;\n"; print " st->privateData =3D netst;\n"; diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index f0d30b63ba..39ccbd739c 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -1065,7 +1065,7 @@ void virNetClientAddProgram(virNetClient *client, } =20 =20 -int virNetClientAddStream(virNetClient *client, +void virNetClientAddStream(virNetClient *client, virNetClientStream *st) { virObjectLock(client); @@ -1074,7 +1074,6 @@ int virNetClientAddStream(virNetClient *client, client->streams[client->nstreams-1] =3D virObjectRef(st); =20 virObjectUnlock(client); - return 0; } =20 =20 diff --git a/src/rpc/virnetclient.h b/src/rpc/virnetclient.h index 7726b57ef4..29099791a0 100644 --- a/src/rpc/virnetclient.h +++ b/src/rpc/virnetclient.h @@ -120,7 +120,7 @@ bool virNetClientHasPassFD(virNetClient *client); void virNetClientAddProgram(virNetClient *client, virNetClientProgram *prog); =20 -int virNetClientAddStream(virNetClient *client, +void virNetClientAddStream(virNetClient *client, virNetClientStream *st); =20 void virNetClientRemoveStream(virNetClient *client, --=20 2.42.2