lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <aLGSDpi4xDjUUYVm@kspp>
Date: Fri, 29 Aug 2025 13:42:06 +0200
From: "Gustavo A. R. Silva" <gustavoars@...nel.org>
To: "K. Y. Srinivasan" <kys@...rosoft.com>,
	Haiyang Zhang <haiyangz@...rosoft.com>,
	Wei Liu <wei.liu@...nel.org>, Dexuan Cui <decui@...rosoft.com>
Cc: linux-hyperv@...r.kernel.org, linux-kernel@...r.kernel.org,
	"Gustavo A. R. Silva" <gustavoars@...nel.org>,
	linux-hardening@...r.kernel.org
Subject: [PATCH][next] hyperv: Avoid a hundred -Wflex-array-member-at-end
 warnings

-Wflex-array-member-not-at-end was introduced in GCC-14, and we are
getting ready to enable it, globally.

Use the new TRAILING_OVERLAP() helper to fix 159 of the following type
of warnings:

    159 ./include/linux/hyperv.h:711:38: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

This helper creates a union between a flexible-array member (FAM)
and a set of members that would otherwise follow it. This overlays
the trailing members onto the FAM while preserving the original
memory layout.

Also, move `struct vmbus_close_msg close_msg;` at the end of
`struct vmbus_channel`, as `struct vmbus_channel_msginfo,` ends
in a flexible array member.

Signed-off-by: Gustavo A. R. Silva <gustavoars@...nel.org>
---
 include/linux/hyperv.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index a59c5c3e95fb..efdd570669fa 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -708,8 +708,9 @@ struct vmbus_channel_msginfo {
 };
 
 struct vmbus_close_msg {
-	struct vmbus_channel_msginfo info;
-	struct vmbus_channel_close_channel msg;
+	TRAILING_OVERLAP(struct vmbus_channel_msginfo, info, msg,
+		struct vmbus_channel_close_channel msg;
+	);
 };
 
 enum vmbus_device_type {
@@ -800,8 +801,6 @@ struct vmbus_channel {
 	struct hv_ring_buffer_info outbound;	/* send to parent */
 	struct hv_ring_buffer_info inbound;	/* receive from parent */
 
-	struct vmbus_close_msg close_msg;
-
 	/* Statistics */
 	u64	interrupts;	/* Host to Guest interrupts */
 	u64	sig_events;	/* Guest to Host events */
@@ -1008,6 +1007,9 @@ struct vmbus_channel {
 
 	/* boolean to control visibility of sysfs for ring buffer */
 	bool ring_sysfs_visible;
+
+	/* Must be last --ends in a flexible-array member. */
+	struct vmbus_close_msg close_msg;
 };
 
 #define lock_requestor(channel, flags)					\
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ