On Tue, May 13, 2025 at 09:44:40PM -0700, mhkelle...@gmail.com wrote:
> From: Michael Kelley <mhkli...@outlook.com>
> 
> struct pci_packet contains a "message" field that is a flex array
> of struct pci_message. struct pci_packet is usually followed by a
> second struct in a containing struct that is defined locally in
> individual functions in pci-hyperv.c. As such, the compiler
> flag -Wflex-array-member-not-at-end (introduced in gcc-14) generates
> multiple warnings such as:
> 
> drivers/pci/controller/pci-hyperv.c:3809:35: warning: structure
>     containing a flexible array member is not at the end of another
>     structure [-Wflex-array-member-not-at-end]
> 
> The Linux kernel intends to introduce this compiler flag in standard
> builds, so the current code is problematic in generating these warnings.
> 
> The "message" field is used only to locate the start of the second
> struct, and not as an array. Because the second struct can be
> addressed directly, the "message" field is not really necessary.
> Rather than try to fix its usage to meet the requirements of
> -Wflex-array-member-not-at-end, just eliminate the field and
> either directly reference the second struct, or use "pkt + 1"
> when "pkt" is dynamically allocated.
> 
> Reported-by: Gustavo A. R. Silva <gustavo...@kernel.org>
> Signed-off-by: Michael Kelley <mhkli...@outlook.com>

Queued. Thanks.

Reply via email to