From nobody Thu Dec 26 20:56:37 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 1732800894727187.79483496224032; Thu, 28 Nov 2024 05:34:54 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 2EAC61B6A; Thu, 28 Nov 2024 08:34:54 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id EEA911C88; Thu, 28 Nov 2024 08:33:32 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 0B5B1194E; Thu, 28 Nov 2024 08:31:57 -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 959B4194E for ; Thu, 28 Nov 2024 08:31:51 -0500 (EST) Received: from kuznetsovam-nb.office.basealt.ru (unknown [193.43.10.250]) by air.basealt.ru (Postfix) with ESMTPSA id 2CA162353E; Thu, 28 Nov 2024 16:31:50 +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 1/4] util: Change return type of virPCIDeviceSetUsedBy to void Date: Thu, 28 Nov 2024 16:28:07 +0300 Message-ID: <20241128133105.31975-2-kuznetsovam@altlinux.org> X-Mailer: git-send-email 2.42.2 In-Reply-To: <20241128133105.31975-1-kuznetsovam@altlinux.org> References: <20241128133105.31975-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: MVC6WJYT5HW4M2BZZKKPNCFGYIHTUB3O X-Message-ID-Hash: MVC6WJYT5HW4M2BZZKKPNCFGYIHTUB3O X-Mailman-Approved-At: Thu, 28 Nov 2024 13:33:24 -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: 1732800894929019100 Content-Type: text/plain; charset="utf-8" This function return value is invariant since 18f3771, 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/hypervisor/virhostdev.c | 6 ++---- src/util/virpci.c | 4 +--- src/util/virpci.h | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c index db94a2e056..f8b5ab86e1 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -1131,8 +1131,7 @@ virHostdevUpdateActivePCIDevices(virHostdevManager *m= gr, if (!actual) continue; =20 - if (virPCIDeviceSetUsedBy(actual, drv_name, dom_name) < 0) - goto cleanup; + virPCIDeviceSetUsedBy(actual, drv_name, dom_name); =20 /* Setup the original states for the PCI device */ virPCIDeviceSetUnbindFromStub(actual, virBitmapIsBitSet(orig, VIR_= DOMAIN_HOSTDEV_PCI_ORIGSTATE_UNBIND)); @@ -2480,8 +2479,7 @@ virHostdevUpdateActiveNVMeDevices(virHostdevManager *= hostdev_mgr, =20 /* We must restore some attributes that were lost on daemon restar= t. */ virPCIDeviceSetUnbindFromStub(actual, true); - if (virPCIDeviceSetUsedBy(actual, drv_name, dom_name) < 0) - goto rollback; + virPCIDeviceSetUsedBy(actual, drv_name, dom_name); =20 if (virPCIDeviceListAddCopy(hostdev_mgr->activePCIHostdevs, actual= ) < 0) goto rollback; diff --git a/src/util/virpci.c b/src/util/virpci.c index 289c0b330b..90617e69c6 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -2049,7 +2049,7 @@ virPCIDeviceSetReprobe(virPCIDevice *dev, bool reprob= e) dev->reprobe =3D reprobe; } =20 -int +void virPCIDeviceSetUsedBy(virPCIDevice *dev, const char *drv_name, const char *dom_name) @@ -2058,8 +2058,6 @@ virPCIDeviceSetUsedBy(virPCIDevice *dev, VIR_FREE(dev->used_by_domname); dev->used_by_drvname =3D g_strdup(drv_name); dev->used_by_domname =3D g_strdup(dom_name); - - return 0; } =20 void diff --git a/src/util/virpci.h b/src/util/virpci.h index ba5e0ae6f1..c5dcf9d37f 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -136,7 +136,7 @@ void virPCIDeviceSetStubDriverName(virPCIDevice *dev, const char *driverName); const char *virPCIDeviceGetStubDriverName(virPCIDevice *dev); virPCIDeviceAddress *virPCIDeviceGetAddress(virPCIDevice *dev); -int virPCIDeviceSetUsedBy(virPCIDevice *dev, +void virPCIDeviceSetUsedBy(virPCIDevice *dev, const char *drv_name, const char *dom_name); void virPCIDeviceGetUsedBy(virPCIDevice *dev, --=20 2.42.2 From nobody Thu Dec 26 20:56:37 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 1732800842324809.4914203994177; Thu, 28 Nov 2024 05:34:02 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id A82351CFC; Thu, 28 Nov 2024 08:34:01 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id E37081CC6; Thu, 28 Nov 2024 08:33:27 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 04436197F; Thu, 28 Nov 2024 08:31:54 -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 621701966 for ; Thu, 28 Nov 2024 08:31:53 -0500 (EST) Received: from kuznetsovam-nb.office.basealt.ru (unknown [193.43.10.250]) by air.basealt.ru (Postfix) with ESMTPSA id 49FE423796; Thu, 28 Nov 2024 16:31:52 +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/4] util: Change return type of virSCSIDeviceSetUsedBy to void Date: Thu, 28 Nov 2024 16:28:08 +0300 Message-ID: <20241128133105.31975-3-kuznetsovam@altlinux.org> X-Mailer: git-send-email 2.42.2 In-Reply-To: <20241128133105.31975-1-kuznetsovam@altlinux.org> References: <20241128133105.31975-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: CRHOY5QSBYKEX5T5DHVL5MSNVIDMZQIM X-Message-ID-Hash: CRHOY5QSBYKEX5T5DHVL5MSNVIDMZQIM X-Mailman-Approved-At: Thu, 28 Nov 2024 13:33:24 -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: 1732800842675019100 Content-Type: text/plain; charset="utf-8" This function return value is invariant since 18f3771, 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 --- src/hypervisor/virhostdev.c | 12 ++++-------- src/util/virscsi.c | 4 +--- src/util/virscsi.h | 2 +- tests/virscsitest.c | 6 ++---- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c index f8b5ab86e1..30a51507da 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -1212,11 +1212,9 @@ virHostdevUpdateActiveSCSIHostDevices(virHostdevMana= ger *mgr, return -1; =20 if ((tmp =3D virSCSIDeviceListFind(mgr->activeSCSIHostdevs, scsi))) { - if (virSCSIDeviceSetUsedBy(tmp, drv_name, dom_name) < 0) - return -1; + virSCSIDeviceSetUsedBy(tmp, drv_name, dom_name); } else { - if (virSCSIDeviceSetUsedBy(scsi, drv_name, dom_name) < 0 || - virSCSIDeviceListAdd(mgr->activeSCSIHostdevs, scsi) < 0) + if (virSCSIDeviceListAdd(mgr->activeSCSIHostdevs, scsi) < 0) return -1; scsi =3D NULL; } @@ -1597,11 +1595,9 @@ virHostdevPrepareSCSIDevices(virHostdevManager *mgr, goto error; } =20 - if (virSCSIDeviceSetUsedBy(tmp, drv_name, dom_name) < 0) - goto error; + virSCSIDeviceSetUsedBy(tmp, drv_name, dom_name); } else { - if (virSCSIDeviceSetUsedBy(scsi, drv_name, dom_name) < 0) - goto error; + virSCSIDeviceSetUsedBy(scsi, drv_name, dom_name); =20 VIR_DEBUG("Adding %s to activeSCSIHostdevs", virSCSIDeviceGetN= ame(scsi)); =20 diff --git a/src/util/virscsi.c b/src/util/virscsi.c index 3d2c77e3b8..6899958e21 100644 --- a/src/util/virscsi.c +++ b/src/util/virscsi.c @@ -243,7 +243,7 @@ virSCSIDeviceFree(virSCSIDevice *dev) g_free(dev); } =20 -int +void virSCSIDeviceSetUsedBy(virSCSIDevice *dev, const char *drvname, const char *domname) @@ -255,8 +255,6 @@ virSCSIDeviceSetUsedBy(virSCSIDevice *dev, copy->domname =3D g_strdup(domname); =20 VIR_APPEND_ELEMENT(dev->used_by, dev->n_used_by, copy); - - return 0; } =20 bool diff --git a/src/util/virscsi.h b/src/util/virscsi.h index ec34303bdc..d76ee13bcc 100644 --- a/src/util/virscsi.h +++ b/src/util/virscsi.h @@ -50,7 +50,7 @@ virSCSIDevice *virSCSIDeviceNew(const char *sysfs_prefix, bool shareable); =20 void virSCSIDeviceFree(virSCSIDevice *dev); -int virSCSIDeviceSetUsedBy(virSCSIDevice *dev, +void virSCSIDeviceSetUsedBy(virSCSIDevice *dev, const char *drvname, const char *domname); bool virSCSIDeviceIsAvailable(virSCSIDevice *dev); diff --git a/tests/virscsitest.c b/tests/virscsitest.c index c96699e157..2c3b599c7a 100644 --- a/tests/virscsitest.c +++ b/tests/virscsitest.c @@ -87,14 +87,12 @@ test2(const void *data G_GNUC_UNUSED) if (!virSCSIDeviceIsAvailable(dev)) goto cleanup; =20 - if (virSCSIDeviceSetUsedBy(dev, "QEMU", "fc18") < 0) - goto cleanup; + virSCSIDeviceSetUsedBy(dev, "QEMU", "fc18"); =20 if (virSCSIDeviceIsAvailable(dev)) goto cleanup; =20 - if (virSCSIDeviceSetUsedBy(dev, "QEMU", "fc20") < 0) - goto cleanup; + virSCSIDeviceSetUsedBy(dev, "QEMU", "fc20"); =20 if (virSCSIDeviceIsAvailable(dev)) goto cleanup; --=20 2.42.2 From nobody Thu Dec 26 20:56:37 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 1732800861050244.78026230857893; Thu, 28 Nov 2024 05:34:21 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7C8611CE8; Thu, 28 Nov 2024 08:34:20 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 902491AB8; Thu, 28 Nov 2024 08:33:29 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 041B3197F; Thu, 28 Nov 2024 08:31:55 -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 43A671966 for ; Thu, 28 Nov 2024 08:31:54 -0500 (EST) Received: from kuznetsovam-nb.office.basealt.ru (unknown [193.43.10.250]) by air.basealt.ru (Postfix) with ESMTPSA id 2C61E237AA; Thu, 28 Nov 2024 16:31:53 +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/4] util: Change return type of virSCSIVHostDeviceSetUsedBy to void Date: Thu, 28 Nov 2024 16:28:09 +0300 Message-ID: <20241128133105.31975-4-kuznetsovam@altlinux.org> X-Mailer: git-send-email 2.42.2 In-Reply-To: <20241128133105.31975-1-kuznetsovam@altlinux.org> References: <20241128133105.31975-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: UXHITFV62ZB2WC3LMBQQEMFZPNHHVHW6 X-Message-ID-Hash: UXHITFV62ZB2WC3LMBQQEMFZPNHHVHW6 X-Mailman-Approved-At: Thu, 28 Nov 2024 13:33:24 -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: 1732800862843019100 Content-Type: text/plain; charset="utf-8" This function return value is invariant since 18f3771, 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 --- src/hypervisor/virhostdev.c | 3 +-- src/util/virscsivhost.c | 6 ++---- src/util/virscsivhost.h | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c index 30a51507da..037842c8a1 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -1666,8 +1666,7 @@ virHostdevPrepareSCSIVHostDevices(virHostdevManager *= mgr, if (!(host =3D virSCSIVHostDeviceNew(hostsrc->wwpn))) return -1; =20 - if (virSCSIVHostDeviceSetUsedBy(host, drv_name, dom_name) < 0) - return -1; + virSCSIVHostDeviceSetUsedBy(host, drv_name, dom_name); =20 if (virSCSIVHostDeviceListAdd(list, host) < 0) return -1; diff --git a/src/util/virscsivhost.c b/src/util/virscsivhost.c index 15024d7106..05b89e58d6 100644 --- a/src/util/virscsivhost.c +++ b/src/util/virscsivhost.c @@ -193,7 +193,7 @@ virSCSIVHostDeviceListNew(void) } =20 =20 -int +void virSCSIVHostDeviceSetUsedBy(virSCSIVHostDevice *dev, const char *drvname, const char *domname) @@ -202,8 +202,6 @@ virSCSIVHostDeviceSetUsedBy(virSCSIVHostDevice *dev, VIR_FREE(dev->used_by_domname); dev->used_by_drvname =3D g_strdup(drvname); dev->used_by_domname =3D g_strdup(domname); - - return 0; } =20 =20 @@ -214,7 +212,7 @@ virSCSIVHostDeviceGetUsedBy(virSCSIVHostDevice *dev, { *drv_name =3D dev->used_by_drvname; *dom_name =3D dev->used_by_domname; - } +} =20 =20 int diff --git a/src/util/virscsivhost.h b/src/util/virscsivhost.h index a7299382db..caaac26328 100644 --- a/src/util/virscsivhost.h +++ b/src/util/virscsivhost.h @@ -50,7 +50,7 @@ void virSCSIVHostDeviceListDel(virSCSIVHostDeviceList *li= st, virSCSIVHostDevice *dev); virSCSIVHostDeviceList *virSCSIVHostDeviceListNew(void); virSCSIVHostDevice *virSCSIVHostDeviceNew(const char *name); -int virSCSIVHostDeviceSetUsedBy(virSCSIVHostDevice *dev, +void virSCSIVHostDeviceSetUsedBy(virSCSIVHostDevice *dev, const char *drvname, const char *domname); void virSCSIVHostDeviceGetUsedBy(virSCSIVHostDevice *dev, --=20 2.42.2 From nobody Thu Dec 26 20:56:37 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 1732800877902429.7146497645215; Thu, 28 Nov 2024 05:34:37 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 4789F1CC5; Thu, 28 Nov 2024 08:34:37 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 791F619BE; Thu, 28 Nov 2024 08:33:32 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 9A5ED196D; Thu, 28 Nov 2024 08:31:55 -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 07F80194C for ; Thu, 28 Nov 2024 08:31:55 -0500 (EST) Received: from kuznetsovam-nb.office.basealt.ru (unknown [193.43.10.250]) by air.basealt.ru (Postfix) with ESMTPSA id E4236237B3; Thu, 28 Nov 2024 16:31:53 +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/4] logging: Change return type of virLogDaemonConfigFilePat to void Date: Thu, 28 Nov 2024 16:28:10 +0300 Message-ID: <20241128133105.31975-5-kuznetsovam@altlinux.org> X-Mailer: git-send-email 2.42.2 In-Reply-To: <20241128133105.31975-1-kuznetsovam@altlinux.org> References: <20241128133105.31975-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: I2LH47RQGNTYTGENCT3CSHUDCHVPONUJ X-Message-ID-Hash: I2LH47RQGNTYTGENCT3CSHUDCHVPONUJ X-Mailman-Approved-At: Thu, 28 Nov 2024 13:33:24 -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: 1732800878912019100 Content-Type: text/plain; charset="utf-8" This function return value is invariant since 18f3771, 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/logging/log_daemon.c | 8 ++------ src/logging/log_daemon_config.c | 4 +--- src/logging/log_daemon_config.h | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c index daf7ef4b2f..5a9be4a44e 100644 --- a/src/logging/log_daemon.c +++ b/src/logging/log_daemon.c @@ -692,14 +692,10 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } =20 - /* No explicit config, so try and find a default one */ + /* No explicit config, so find a default one */ if (remote_config_file =3D=3D NULL) { implicit_conf =3D true; - if (virLogDaemonConfigFilePath(privileged, - &remote_config_file) < 0) { - VIR_ERROR(_("Can't determine config path")); - exit(EXIT_FAILURE); - } + virLogDaemonConfigFilePath(privileged, &remote_config_file); } =20 /* Read the config file if it exists */ diff --git a/src/logging/log_daemon_config.c b/src/logging/log_daemon_confi= g.c index 248bd927d3..60c424ad84 100644 --- a/src/logging/log_daemon_config.c +++ b/src/logging/log_daemon_config.c @@ -33,7 +33,7 @@ VIR_LOG_INIT("logging.log_daemon_config"); =20 =20 -int +void virLogDaemonConfigFilePath(bool privileged, char **configfile) { if (privileged) { @@ -45,8 +45,6 @@ virLogDaemonConfigFilePath(bool privileged, char **config= file) =20 *configfile =3D g_strdup_printf("%s/virtlogd.conf", configdir); } - - return 0; } =20 =20 diff --git a/src/logging/log_daemon_config.h b/src/logging/log_daemon_confi= g.h index 43922feedf..5c10cc50d7 100644 --- a/src/logging/log_daemon_config.h +++ b/src/logging/log_daemon_config.h @@ -39,7 +39,7 @@ struct _virLogDaemonConfig { }; =20 =20 -int virLogDaemonConfigFilePath(bool privileged, char **configfile); +void virLogDaemonConfigFilePath(bool privileged, char **configfile); virLogDaemonConfig *virLogDaemonConfigNew(bool privileged); void virLogDaemonConfigFree(virLogDaemonConfig *data); int virLogDaemonConfigLoadFile(virLogDaemonConfig *data, --=20 2.42.2