linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu@kernel.org>
To: mhklinux@outlook.com
Cc: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org,
	decui@microsoft.com, lpieralisi@kernel.org, kw@linux.com,
	manivannan.sadhasivam@linaro.org, robh@kernel.org,
	bhelgaas@google.com, gustavoars@kernel.org,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hyperv@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH 1/1] PCI: hv: Remove unnecessary flex array in struct pci_packet
Date: Wed, 14 May 2025 06:43:43 +0000	[thread overview]
Message-ID: <aCQ7n4U55j6dvkzl@liuwe-devbox-ubuntu-v2.tail21d00.ts.net> (raw)
In-Reply-To: <20250514044440.48924-1-mhklinux@outlook.com>

On Tue, May 13, 2025 at 09:44:40PM -0700, mhkelley58@gmail.com wrote:
> From: Michael Kelley <mhklinux@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 <gustavoars@kernel.org>
> Signed-off-by: Michael Kelley <mhklinux@outlook.com>

Queued. Thanks.

      reply	other threads:[~2025-05-14  6:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-14  4:44 [PATCH 1/1] PCI: hv: Remove unnecessary flex array in struct pci_packet mhkelley58
2025-05-14  6:43 ` Wei Liu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aCQ7n4U55j6dvkzl@liuwe-devbox-ubuntu-v2.tail21d00.ts.net \
    --to=wei.liu@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=decui@microsoft.com \
    --cc=gustavoars@kernel.org \
    --cc=haiyangz@microsoft.com \
    --cc=kw@linux.com \
    --cc=kys@microsoft.com \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=mhklinux@outlook.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).