From b0da352c58b568128e80470fd3c1189eb7de19a0 Mon Sep 17 00:00:00 2001 From: Alexander Kuznetsov Date: Thu, 28 Nov 2024 18:21:19 +0300 Subject: [PATCH] rpc: Change return type of virNetClientAddProgram to void 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 | 5 ++--- src/rpc/virnetclient.h | 4 ++-- 7 files changed, 11 insertions(+), 18 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; - if (virNetClientAddProgram(priv->client, priv->program) < 0) - goto error; + virNetClientAddProgram(priv->client, priv->program); return priv; error: diff --git a/src/locking/lock_driver_lockd.c b/src/locking/lock_driver_lockd.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 *virLockManagerLockDaemonConnectionNew(bool privileged, NULL))) goto error; - if (virNetClientAddProgram(client, *prog) < 0) - goto error; + virNetClientAddProgram(client, *prog); return client; 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; - if (virNetClientAddProgram(client, *prog) < 0) - goto error; + virNetClientAddProgram(client, *prog); 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; - if (virNetClientAddProgram(mon->client, - mon->program) < 0) - goto error; + virNetClientAddProgram(mon->client, mon->program); mon->vm = 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; - 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); /* Try and authenticate with server */ VIR_DEBUG("Trying authentication"); diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index 6d424eb599..62d2368c9a 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -1053,8 +1053,8 @@ bool virNetClientIsOpen(virNetClient *client) } -int virNetClientAddProgram(virNetClient *client, - virNetClientProgram *prog) +void virNetClientAddProgram(virNetClient *client, + virNetClientProgram *prog) { virObjectLock(client); @@ -1062,7 +1062,6 @@ int virNetClientAddProgram(virNetClient *client, client->programs[client->nprograms-1] = virObjectRef(prog); virObjectUnlock(client); - return 0; } diff --git a/src/rpc/virnetclient.h b/src/rpc/virnetclient.h index 1647a6cc71..ade3f8babe 100644 --- a/src/rpc/virnetclient.h +++ b/src/rpc/virnetclient.h @@ -117,8 +117,8 @@ int virNetClientDupFD(virNetClient *client, bool cloexec); bool virNetClientHasPassFD(virNetClient *client); -int virNetClientAddProgram(virNetClient *client, - virNetClientProgram *prog); +void virNetClientAddProgram(virNetClient *client, + virNetClientProgram *prog); int virNetClientAddStream(virNetClient *client, virNetClientStream *st);