public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] usb: ehci-fsl: Avoid -Wflex-array-member-not-at-end warning
@ 2025-03-26 22:17 Gustavo A. R. Silva
  2025-03-27  2:09 ` Alan Stern
  0 siblings, 1 reply; 4+ messages in thread
From: Gustavo A. R. Silva @ 2025-03-26 22:17 UTC (permalink / raw)
  To: Alan Stern, Greg Kroah-Hartman
  Cc: linux-usb, linux-kernel, Gustavo A. R. Silva, linux-hardening

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

Move the conflicting declaration to the end of the structure. Notice
that `struct ehci_hcd` is a flexible structure --a structure that
contains a flexible-array member.

Fix the following warning:

drivers/usb/host/ehci-fsl.c:414:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/usb/host/ehci-fsl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 26f13278d4d6..c720d55f4982 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -411,12 +411,13 @@ static int ehci_fsl_setup(struct usb_hcd *hcd)
 }
 
 struct ehci_fsl {
-	struct ehci_hcd	ehci;
-
 #ifdef CONFIG_PM
 	/* Saved USB PHY settings, need to restore after deep sleep. */
 	u32 usb_ctrl;
 #endif
+
+	/* Must be last --ends in a flexible-array member. */
+	struct ehci_hcd	ehci;
 };
 
 #ifdef CONFIG_PM
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-04-07 19:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-26 22:17 [PATCH][next] usb: ehci-fsl: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
2025-03-27  2:09 ` Alan Stern
2025-03-27 19:31   ` [PATCH] usb: ehci-fsl: Fix use of private data to avoid " Alan Stern
2025-04-07 19:15     ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox