]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
usb: ehci-fsl: Fix use of private data to avoid -Wflex-array-member-not-at-end warning
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 27 Mar 2025 19:31:15 +0000 (15:31 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Apr 2025 14:08:33 +0000 (16:08 +0200)
commit54f9823ba75655220ee068feecd333dd3bf66d35
tree8d76f10f9bbbd8c6ba8685ca9529421ed117bbb6
parent387602d8a75574fafb451b7a8215e78dfd67ee63
usb: ehci-fsl: Fix use of private data to avoid -Wflex-array-member-not-at-end warning

In the course of fixing up the usages of flexible arrays, Gustavo
submitted a patch updating the ehci-fsl driver.  However, the patch
was wrong because the driver was using the .priv member of the
ehci_hcd structure incorrectly.  The private data is not supposed to
be a wrapper containing the ehci_hcd structure; it is supposed to be a
sub-structure stored in the .priv member.

Fix the problem by replacing the ehci_fsl structure with
ehci_fsl_priv, containing only the private data, along with a suitable
conversion macro for accessing it.  This removes the problem of having
data follow a flexible array member.

Reported-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/linux-usb/Z-R9BcnSzrRv5FX_@kspp/
Reviewed-by: Kees Cook <kees@kernel.org>
Link: https://lore.kernel.org/r/8139e4cc-4e5c-40e2-9c4b-717ad3215868@rowland.harvard.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/ehci-fsl.c