[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aCQ7n4U55j6dvkzl@liuwe-devbox-ubuntu-v2.tail21d00.ts.net>
Date: Wed, 14 May 2025 06:43:43 +0000
From: Wei Liu <wei.liu@...nel.org>
To: mhklinux@...look.com
Cc: kys@...rosoft.com, haiyangz@...rosoft.com, wei.liu@...nel.org,
decui@...rosoft.com, lpieralisi@...nel.org, kw@...ux.com,
manivannan.sadhasivam@...aro.org, robh@...nel.org,
bhelgaas@...gle.com, gustavoars@...nel.org,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hyperv@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH 1/1] PCI: hv: Remove unnecessary flex array in struct
pci_packet
On Tue, May 13, 2025 at 09:44:40PM -0700, mhkelley58@...il.com wrote:
> From: Michael Kelley <mhklinux@...look.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 <gustavoars@...nel.org>
> Signed-off-by: Michael Kelley <mhklinux@...look.com>
Queued. Thanks.
Powered by blists - more mailing lists