From nobody Sat Nov 23 12:26:28 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; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1716372583703572.5867146772056; Wed, 22 May 2024 03:09:43 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 861E619AD; Wed, 22 May 2024 06:09:42 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id AC545197E; Wed, 22 May 2024 06:08:45 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EAAFD1940; Wed, 22 May 2024 06:08:42 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 4C74D1939 for ; Wed, 22 May 2024 06:08:42 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-83-rFbNTMzoOWudsA4GgYJCWg-1; Wed, 22 May 2024 06:08:40 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 23593101A525 for ; Wed, 22 May 2024 10:08:40 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.3.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2B7F401405 for ; Wed, 22 May 2024 10:08:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716372522; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=angE8eeOm6ZtnvBqDSDpW1sh3nHSReX/FJUJBMopI84=; b=a5Arm3eR42AvgDvL++/X1bCNrv3KR8zuBNeM8usPUG32Co9OKelM+iuswf3JF63ydtHGlL oUFe/Rh5STaO+DlVs2+n21Y1T7qC0xNU7i5hJUUGkAfEM2riDmh1iiA5PrZ3/T8letgJaI NkvRG3BXl28d332k8nmwFOaUGMe5hPc= X-MC-Unique: rFbNTMzoOWudsA4GgYJCWg-1 From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH] src: Fix return types of .stateInitialize callbacks Date: Wed, 22 May 2024 12:08:15 +0200 Message-ID: <3fd9747bb42963c692be2c6d999b22b189999fa2.1716372495.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: R4LYA74LYYOZYF3HFTWFA7BBXD43RRAD X-Message-ID-Hash: R4LYA74LYYOZYF3HFTWFA7BBXD43RRAD X-MailFrom: mprivozn@redhat.com 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; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header 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-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1716372584883100001 Content-Type: text/plain; charset="utf-8"; x-default="true" The virStateDriver struct has .stateInitialize callback which is declared to return virDrvStateInitResult enum. But some drivers return a plain int in their implementation which is UB. Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- src/bhyve/bhyve_driver.c | 2 +- src/ch/ch_driver.c | 11 ++++++----- src/interface/interface_backend_netcf.c | 2 +- src/interface/interface_backend_udev.c | 2 +- src/libxl/libxl_driver.c | 2 +- src/lxc/lxc_driver.c | 11 ++++++----- src/network/bridge_driver.c | 2 +- src/node_device/node_device_udev.c | 2 +- src/nwfilter/nwfilter_driver.c | 2 +- src/qemu/qemu_driver.c | 2 +- src/remote/remote_driver.c | 2 +- src/secret/secret_driver.c | 2 +- src/storage/storage_driver.c | 2 +- src/vz/vz_driver.c | 2 +- 14 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 4203b13f94..2bd1e4c387 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1176,7 +1176,7 @@ bhyveStateCleanup(void) return 0; } =20 -static int +static virDrvStateInitResult bhyveStateInitialize(bool privileged, const char *root, bool monolithic G_GNUC_UNUSED, diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index 7308f40249..fbeac60825 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -1365,11 +1365,12 @@ static int chStateCleanup(void) return 0; } =20 -static int chStateInitialize(bool privileged, - const char *root, - bool monolithic G_GNUC_UNUSED, - virStateInhibitCallback callback G_GNUC_UNUSE= D, - void *opaque G_GNUC_UNUSED) +static virDrvStateInitResult +chStateInitialize(bool privileged, + const char *root, + bool monolithic G_GNUC_UNUSED, + virStateInhibitCallback callback G_GNUC_UNUSED, + void *opaque G_GNUC_UNUSED) { int ret =3D VIR_DRV_STATE_INIT_ERROR; int rv; diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interf= ace_backend_netcf.c index d4a11157cc..16e1215663 100644 --- a/src/interface/interface_backend_netcf.c +++ b/src/interface/interface_backend_netcf.c @@ -86,7 +86,7 @@ virNetcfDriverStateDispose(void *obj) } =20 =20 -static int +static virDrvStateInitResult netcfStateInitialize(bool privileged, const char *root, bool monolithic G_GNUC_UNUSED, diff --git a/src/interface/interface_backend_udev.c b/src/interface/interfa= ce_backend_udev.c index 8bb19d7764..fdf11a8318 100644 --- a/src/interface/interface_backend_udev.c +++ b/src/interface/interface_backend_udev.c @@ -1091,7 +1091,7 @@ udevInterfaceIsActive(virInterfacePtr ifinfo) static int udevStateCleanup(void); =20 -static int +static virDrvStateInitResult udevStateInitialize(bool privileged, const char *root, bool monolithic G_GNUC_UNUSED, diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 4d5eb920bf..7dcae58413 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -645,7 +645,7 @@ libxlAddDom0(libxlDriverPrivate *driver) return ret; } =20 -static int +static virDrvStateInitResult libxlStateInitialize(bool privileged, const char *root, bool monolithic G_GNUC_UNUSED, diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 1842ae8f0e..f76d09e8a9 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1429,11 +1429,12 @@ lxcSecurityInit(virLXCDriverConfig *cfg) } =20 =20 -static int lxcStateInitialize(bool privileged, - const char *root, - bool monolithic G_GNUC_UNUSED, - virStateInhibitCallback callback G_GNUC_UNUS= ED, - void *opaque G_GNUC_UNUSED) +static virDrvStateInitResult +lxcStateInitialize(bool privileged, + const char *root, + bool monolithic G_GNUC_UNUSED, + virStateInhibitCallback callback G_GNUC_UNUSED, + void *opaque G_GNUC_UNUSED) { virLXCDriverConfig *cfg =3D NULL; bool autostart =3D true; diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index e5f9ecf9e8..d7c1ef172d 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -576,7 +576,7 @@ firewalld_dbus_signal_callback(GDBusConnection *connect= ion G_GNUC_UNUSED, * * Initialization function for the QEMU daemon */ -static int +static virDrvStateInitResult networkStateInitialize(bool privileged, const char *root, bool monolithic G_GNUC_UNUSED, diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index f1e402f8f7..237cd7f645 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -2229,7 +2229,7 @@ mdevctlEventHandleCallback(GFileMonitor *monitor G_GN= UC_UNUSED, } =20 =20 -static int +static virDrvStateInitResult nodeStateInitialize(bool privileged, const char *root, bool monolithic G_GNUC_UNUSED, diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index 09719edd75..8ece91bf7c 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -208,7 +208,7 @@ nwfilterStateCleanup(void) * * Initialization function for the QEMU daemon */ -static int +static virDrvStateInitResult nwfilterStateInitialize(bool privileged, const char *root, bool monolithic G_GNUC_UNUSED, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d01f788aea..e2698c7924 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -546,7 +546,7 @@ qemuDomainFindMaxID(virDomainObj *vm, * * Initialization function for the QEMU daemon */ -static int +static virDrvStateInitResult qemuStateInitialize(bool privileged, const char *root, bool monolithic G_GNUC_UNUSED, diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 7b73d97b7a..e76d9e9ba4 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -174,7 +174,7 @@ static void make_nonnull_domain_snapshot(remote_nonnull= _domain_snapshot *snapsho /* Helper functions for remoteOpen. */ =20 =20 -static int +static virDrvStateInitResult remoteStateInitialize(bool privileged G_GNUC_UNUSED, const char *root G_GNUC_UNUSED, bool monolithic, diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c index c7bd65b4e9..a2d6b879d0 100644 --- a/src/secret/secret_driver.c +++ b/src/secret/secret_driver.c @@ -488,7 +488,7 @@ secretStateCleanup(void) } =20 =20 -static int +static virDrvStateInitResult secretStateInitialize(bool privileged, const char *root, bool monolithic G_GNUC_UNUSED, diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 314fe930e0..86c03762d2 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -239,7 +239,7 @@ storageDriverAutostart(void) * * Initialization function for the Storage Driver */ -static int +static virDrvStateInitResult storageStateInitialize(bool privileged, const char *root, bool monolithic G_GNUC_UNUSED, diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index 380fdcb57e..4edea4bf18 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -4068,7 +4068,7 @@ vzStateCleanup(void) return 0; } =20 -static int +static virDrvStateInitResult vzStateInitialize(bool privileged, const char *root, bool monolithic G_GNUC_UNUSED, --=20 2.44.1