From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: "Gustavo A. R. Silva" <gustavoars@kernel.org>,
Juergen Gross <jgross@suse.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH][next] xen/pci: Avoid -Wflex-array-member-not-at-end warning
Date: Fri, 13 Sep 2024 10:07:16 +0200 [thread overview]
Message-ID: <9fabe73e-23ea-49f2-9c06-17766a07fe9d@embeddedor.com> (raw)
In-Reply-To: <ZsU58MvoYEEqBHZl@elsanto>
Hi all,
Friendly ping: who can take this, please? 🙂
Thanks
--
Gustavo
On 21/08/24 02:50, Gustavo A. R. Silva wrote:
> Use the `DEFINE_RAW_FLEX()` helper for an on-stack definition of
> a flexible structure where the size of the flexible-array member
> is known at compile-time, and refactor the rest of the code,
> accordingly.
>
> So, with this, fix the following warning:
>
> drivers/xen/pci.c:48:55: 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/xen/pci.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/xen/pci.c b/drivers/xen/pci.c
> index 72d4e3f193af..a2facd8f7e51 100644
> --- a/drivers/xen/pci.c
> +++ b/drivers/xen/pci.c
> @@ -44,15 +44,11 @@ static int xen_add_device(struct device *dev)
> }
> #endif
> if (pci_seg_supported) {
> - struct {
> - struct physdev_pci_device_add add;
> - uint32_t pxm;
> - } add_ext = {
> - .add.seg = pci_domain_nr(pci_dev->bus),
> - .add.bus = pci_dev->bus->number,
> - .add.devfn = pci_dev->devfn
> - };
> - struct physdev_pci_device_add *add = &add_ext.add;
> + DEFINE_RAW_FLEX(struct physdev_pci_device_add, add, optarr, 1);
> +
> + add->seg = pci_domain_nr(pci_dev->bus);
> + add->bus = pci_dev->bus->number;
> + add->devfn = pci_dev->devfn;
>
> #ifdef CONFIG_ACPI
> acpi_handle handle;
next prev parent reply other threads:[~2024-09-13 8:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-21 0:50 [PATCH][next] xen/pci: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
2024-08-22 17:41 ` Kees Cook
2024-09-13 8:07 ` Gustavo A. R. Silva [this message]
2024-09-13 8:12 ` Jürgen Groß
2024-09-13 8:16 ` Gustavo A. R. Silva
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=9fabe73e-23ea-49f2-9c06-17766a07fe9d@embeddedor.com \
--to=gustavo@embeddedor.com \
--cc=gustavoars@kernel.org \
--cc=jgross@suse.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleksandr_tyshchenko@epam.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.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