From nobody Sun Dec 22 09:23:48 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 1732807727325966.5950501070442; Thu, 28 Nov 2024 07:28:47 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id BE6FB10B; Thu, 28 Nov 2024 10:28:46 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id A663D1D6F; Thu, 28 Nov 2024 10:27:28 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 6F44617D8; Thu, 28 Nov 2024 10:22:59 -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 CF70B17D6 for ; Thu, 28 Nov 2024 10:22:58 -0500 (EST) Received: from kuznetsovam-nb.office.basealt.ru (unknown [193.43.10.250]) by air.basealt.ru (Postfix) with ESMTPSA id B7F7B23526; Thu, 28 Nov 2024 18:22:57 +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 3/6] rpc: Change return type of virNetClientAddProgram to void Date: Thu, 28 Nov 2024 18:21:19 +0300 Message-ID: <20241128152222.50660-4-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: 26UETCKNRNOYCBLA7TIT23OBUHHPTDFW X-Message-ID-Hash: 26UETCKNRNOYCBLA7TIT23OBUHHPTDFW 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: 1732807727631019100 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/admin/admin_remote.c | 3 +-- src/locking/lock_driver_lockd.c | 3 +-- src/logging/log_manager.c | 3 +-- src/lxc/lxc_monitor.c | 4 +--- src/remote/remote_driver.c | 7 +++---- src/rpc/virnetclient.c | 3 +-- src/rpc/virnetclient.h | 2 +- 7 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/admin/admin_remote.c b/src/admin/admin_remote.c index 3291a1e965..5c4913a76e 100644 --- a/src/admin/admin_remote.c +++ b/src/admin/admin_remote.c @@ -214,8 +214,7 @@ remoteAdminPrivNew(const char *sock_path) NULL, 0, NULL))) goto error; =20 - if (virNetClientAddProgram(priv->client, priv->program) < 0) - goto error; + virNetClientAddProgram(priv->client, priv->program); =20 return priv; error: diff --git a/src/locking/lock_driver_lockd.c b/src/locking/lock_driver_lock= d.c index d75302dd0a..0b6c720477 100644 --- a/src/locking/lock_driver_lockd.c +++ b/src/locking/lock_driver_lockd.c @@ -213,8 +213,7 @@ static virNetClient *virLockManagerLockDaemonConnection= New(bool privileged, NULL))) goto error; =20 - if (virNetClientAddProgram(client, *prog) < 0) - goto error; + virNetClientAddProgram(client, *prog); =20 return client; =20 diff --git a/src/logging/log_manager.c b/src/logging/log_manager.c index d8490f4e5a..19e23d65c5 100644 --- a/src/logging/log_manager.c +++ b/src/logging/log_manager.c @@ -88,8 +88,7 @@ virLogManagerConnect(bool privileged, NULL))) goto error; =20 - if (virNetClientAddProgram(client, *prog) < 0) - goto error; + virNetClientAddProgram(client, *prog); =20 VIR_FREE(daemonPath); VIR_FREE(logdpath); diff --git a/src/lxc/lxc_monitor.c b/src/lxc/lxc_monitor.c index 811d6685e5..cf2fd1897f 100644 --- a/src/lxc/lxc_monitor.c +++ b/src/lxc/lxc_monitor.c @@ -169,9 +169,7 @@ virLXCMonitor *virLXCMonitorNew(virDomainObj *vm, mon))) goto error; =20 - if (virNetClientAddProgram(mon->client, - mon->program) < 0) - goto error; + virNetClientAddProgram(mon->client, mon->program); =20 mon->vm =3D virObjectRef(vm); memcpy(&mon->cb, cb, sizeof(mon->cb)); diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index e76d9e9ba4..4a16b8ef1d 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -1160,10 +1160,9 @@ doRemoteOpen(virConnectPtr conn, conn))) goto error; =20 - if (virNetClientAddProgram(priv->client, priv->remoteProgram) < 0 || - virNetClientAddProgram(priv->client, priv->lxcProgram) < 0 || - virNetClientAddProgram(priv->client, priv->qemuProgram) < 0) - goto error; + virNetClientAddProgram(priv->client, priv->remoteProgram); + virNetClientAddProgram(priv->client, priv->lxcProgram); + virNetClientAddProgram(priv->client, priv->qemuProgram); =20 /* Try and authenticate with server */ VIR_DEBUG("Trying authentication"); diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index 6d424eb599..f0d30b63ba 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -1053,7 +1053,7 @@ bool virNetClientIsOpen(virNetClient *client) } =20 =20 -int virNetClientAddProgram(virNetClient *client, +void virNetClientAddProgram(virNetClient *client, virNetClientProgram *prog) { virObjectLock(client); @@ -1062,7 +1062,6 @@ int virNetClientAddProgram(virNetClient *client, client->programs[client->nprograms-1] =3D virObjectRef(prog); =20 virObjectUnlock(client); - return 0; } =20 =20 diff --git a/src/rpc/virnetclient.h b/src/rpc/virnetclient.h index 1647a6cc71..7726b57ef4 100644 --- a/src/rpc/virnetclient.h +++ b/src/rpc/virnetclient.h @@ -117,7 +117,7 @@ int virNetClientDupFD(virNetClient *client, bool cloexe= c); =20 bool virNetClientHasPassFD(virNetClient *client); =20 -int virNetClientAddProgram(virNetClient *client, +void virNetClientAddProgram(virNetClient *client, virNetClientProgram *prog); =20 int virNetClientAddStream(virNetClient *client, --=20 2.42.2