All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Purva Yeshi <purvayeshi550@gmail.com>
Cc: bhelgaas@google.com, skhan@linuxfoundation.org,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers: pci: Fix flexible array usage
Date: Mon, 10 Feb 2025 16:47:34 -0600	[thread overview]
Message-ID: <20250210224734.GA21793@bhelgaas> (raw)
In-Reply-To: <20250210132740.20068-1-purvayeshi550@gmail.com>

On Mon, Feb 10, 2025 at 06:57:40PM +0530, Purva Yeshi wrote:
> Fix warning detected by smatch tool:
> Array of flexible structure occurs in 'pci_saved_state' struct
> 
> The warning occurs because struct pci_saved_state contains struct
> pci_cap_saved_data cap[], where cap[] has a flexible array member (data[]).
> Arrays of structures with flexible members are not allowed, leading to this
> warning.
> 
> Replaced cap[] with a pointer (*cap), allowing dynamic memory allocation
> instead of embedding an invalid array of flexible structures.
> 
> Signed-off-by: Purva Yeshi <purvayeshi550@gmail.com>

Applied with subject:

  PCI: Fix array of flexible structure usage in struct pci_saved_state

to pci/enumeration for v6.15, thanks!

> ---
>  drivers/pci/pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 869d204a7..648a080ef 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -1929,7 +1929,7 @@ EXPORT_SYMBOL(pci_restore_state);
>  
>  struct pci_saved_state {
>  	u32 config_space[16];
> -	struct pci_cap_saved_data cap[];
> +	struct pci_cap_saved_data *cap;
>  };
>  
>  /**
> -- 
> 2.34.1
> 

  reply	other threads:[~2025-02-10 22:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-10 13:27 [PATCH] drivers: pci: Fix flexible array usage Purva Yeshi
2025-02-10 22:47 ` Bjorn Helgaas [this message]
2025-02-10 23:03 ` Keith Busch
2025-02-11 21:02   ` Bjorn Helgaas
2025-02-11 21:18     ` Keith Busch
2025-02-13 10:48       ` Purva Yeshi
2025-02-13 14:41       ` Ilpo Järvinen
2025-02-13 10:42     ` Purva Yeshi
2025-02-13 10:37   ` Purva Yeshi

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=20250210224734.GA21793@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=purvayeshi550@gmail.com \
    --cc=skhan@linuxfoundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.