From nobody Sun Dec 22 08:47: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 1732807705606263.3315138721945; Thu, 28 Nov 2024 07:28:25 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id E6C81178E; Thu, 28 Nov 2024 10:28:24 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id B21FE1D57; Thu, 28 Nov 2024 10:27:25 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 6227717D8; Thu, 28 Nov 2024 10:22:58 -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 C47E017D6 for ; Thu, 28 Nov 2024 10:22:57 -0500 (EST) Received: from kuznetsovam-nb.office.basealt.ru (unknown [193.43.10.250]) by air.basealt.ru (Postfix) with ESMTPSA id AB204234A6; Thu, 28 Nov 2024 18:22:56 +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 2/6] rpc: Change return type of virNetServerAddProgram to void Date: Thu, 28 Nov 2024 18:21:18 +0300 Message-ID: <20241128152222.50660-3-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: 4JNEI2OZ6UV6YPQPJ3CWTVEGQTXLAEZM X-Message-ID-Hash: 4JNEI2OZ6UV6YPQPJ3CWTVEGQTXLAEZM 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: 1732807707690019100 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/locking/lock_daemon.c | 10 ++-------- src/logging/log_daemon.c | 10 ++-------- src/remote/remote_daemon.c | 20 ++++---------------- src/rpc/virnetserver.c | 3 +-- src/rpc/virnetserver.h | 2 +- 5 files changed, 10 insertions(+), 35 deletions(-) diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c index ba52ce7d77..0b86300b43 100644 --- a/src/locking/lock_daemon.c +++ b/src/locking/lock_daemon.c @@ -1066,10 +1066,7 @@ int main(int argc, char **argv) { goto cleanup; } =20 - if (virNetServerAddProgram(lockSrv, lockProgram) < 0) { - ret =3D VIR_DAEMON_ERR_INIT; - goto cleanup; - } + virNetServerAddProgram(lockSrv, lockProgram); =20 if (adminSrv !=3D NULL) { if (!(adminProgram =3D virNetServerProgramNew(ADMIN_PROGRAM, @@ -1079,10 +1076,7 @@ int main(int argc, char **argv) { ret =3D VIR_DAEMON_ERR_INIT; goto cleanup; } - if (virNetServerAddProgram(adminSrv, adminProgram) < 0) { - ret =3D VIR_DAEMON_ERR_INIT; - goto cleanup; - } + virNetServerAddProgram(adminSrv, adminProgram); } =20 /* Disable error func, now logging is setup */ diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c index daf7ef4b2f..606aafd071 100644 --- a/src/logging/log_daemon.c +++ b/src/logging/log_daemon.c @@ -868,10 +868,7 @@ int main(int argc, char **argv) { ret =3D VIR_DAEMON_ERR_INIT; goto cleanup; } - if (virNetServerAddProgram(logSrv, logProgram) < 0) { - ret =3D VIR_DAEMON_ERR_INIT; - goto cleanup; - } + virNetServerAddProgram(logSrv, logProgram); =20 if (adminSrv !=3D NULL) { if (!(adminProgram =3D virNetServerProgramNew(ADMIN_PROGRAM, @@ -881,10 +878,7 @@ int main(int argc, char **argv) { ret =3D VIR_DAEMON_ERR_INIT; goto cleanup; } - if (virNetServerAddProgram(adminSrv, adminProgram) < 0) { - ret =3D VIR_DAEMON_ERR_INIT; - goto cleanup; - } + virNetServerAddProgram(adminSrv, adminProgram); } =20 /* Disable error func, now logging is setup */ diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c index 9e82132654..1d079c7e4b 100644 --- a/src/remote/remote_daemon.c +++ b/src/remote/remote_daemon.c @@ -1063,10 +1063,7 @@ int main(int argc, char **argv) { ret =3D VIR_DAEMON_ERR_INIT; goto cleanup; } - if (virNetServerAddProgram(srv, remoteProgram) < 0) { - ret =3D VIR_DAEMON_ERR_INIT; - goto cleanup; - } + virNetServerAddProgram(srv, remoteProgram); =20 if (!(lxcProgram =3D virNetServerProgramNew(LXC_PROGRAM, LXC_PROTOCOL_VERSION, @@ -1075,10 +1072,7 @@ int main(int argc, char **argv) { ret =3D VIR_DAEMON_ERR_INIT; goto cleanup; } - if (virNetServerAddProgram(srv, lxcProgram) < 0) { - ret =3D VIR_DAEMON_ERR_INIT; - goto cleanup; - } + virNetServerAddProgram(srv, lxcProgram); =20 if (!(qemuProgram =3D virNetServerProgramNew(QEMU_PROGRAM, QEMU_PROTOCOL_VERSION, @@ -1087,10 +1081,7 @@ int main(int argc, char **argv) { ret =3D VIR_DAEMON_ERR_INIT; goto cleanup; } - if (virNetServerAddProgram(srv, qemuProgram) < 0) { - ret =3D VIR_DAEMON_ERR_INIT; - goto cleanup; - } + virNetServerAddProgram(srv, qemuProgram); =20 if (!(srvAdm =3D virNetServerNew("admin", 1, config->admin_min_workers, @@ -1120,10 +1111,7 @@ int main(int argc, char **argv) { ret =3D VIR_DAEMON_ERR_INIT; goto cleanup; } - if (virNetServerAddProgram(srvAdm, adminProgram) < 0) { - ret =3D VIR_DAEMON_ERR_INIT; - goto cleanup; - } + virNetServerAddProgram(srvAdm, adminProgram); =20 if (timeout > 0) { if (virNetDaemonAutoShutdown(dmn, timeout) < 0) diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c index a6c6443c55..91219c3eed 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -768,7 +768,7 @@ virNetServerAddServiceUNIX(virNetServer *srv, } =20 =20 -int +void virNetServerAddProgram(virNetServer *srv, virNetServerProgram *prog) { @@ -776,7 +776,6 @@ virNetServerAddProgram(virNetServer *srv, =20 VIR_EXPAND_N(srv->programs, srv->nprograms, 1); srv->programs[srv->nprograms-1] =3D virObjectRef(prog); - return 0; } =20 =20 diff --git a/src/rpc/virnetserver.h b/src/rpc/virnetserver.h index 7756a1dd6c..c14d8bd10f 100644 --- a/src/rpc/virnetserver.h +++ b/src/rpc/virnetserver.h @@ -84,7 +84,7 @@ int virNetServerAddServiceUNIX(virNetServer *srv, size_t max_queued_clients, size_t nrequests_client_max); =20 -int virNetServerAddProgram(virNetServer *srv, +void virNetServerAddProgram(virNetServer *srv, virNetServerProgram *prog); =20 int virNetServerSetTLSContext(virNetServer *srv, --=20 2.42.2