mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Prabhakar <prabhakar.csengg@gmail.com>
Cc: "Marek Vasut" <marek.vasut+renesas@mailbox.org>,
	"Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Magnus Damm" <magnus.damm@gmail.com>,
	linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Biju Das" <biju.das.jz@bp.renesas.com>,
	"Fabrizio Castro" <fabrizio.castro.jz@renesas.com>,
	"Lad Prabhakar" <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: Re: [PATCH v2] PCI: rcar-host: Remove unused LIST_HEAD(res)
Date: Fri, 2 Oct 2026 18:32:29 -0500	[thread overview]
Message-ID: <20261002233229.GA401322@bhelgaas> (raw)
In-Reply-To: <20260521091256.15737-1-prabhakar.mahadev-lad.rj@bp.renesas.com>

On Thu, May 21, 2026 at 10:12:56AM +0100, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> Remove the unused LIST_HEAD(res) declaration from rcar_pcie_hw_enable().
> 
> The macro instantiation defines an unused 'struct list_head res' variable,
> which conflicts with a valid resource loop-local 'struct resource *res'
> declaration further down in the function, triggering a compiler variable
> shadowing warning:
> 
> drivers/pci/controller/pcie-rcar-host.c:357:34: warning: declaration of 'res' shadows a previous local [-Wshadow]
> 357 |                  struct resource *res = win->res;
> 
> Fixes: ce351636c67f75a9 ("PCI: rcar: Add suspend/resume")
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> ---
> v1->v2:
> - Updated the commit message to include the warning.
> - Added the Fixes tag.
> - Added Reviewed-by tags for Geert and Marek.
> ---
>  drivers/pci/controller/pcie-rcar-host.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c
> index 213028052aa5..cd9171eebc28 100644
> --- a/drivers/pci/controller/pcie-rcar-host.c
> +++ b/drivers/pci/controller/pcie-rcar-host.c
> @@ -346,7 +346,6 @@ static void rcar_pcie_hw_enable(struct rcar_pcie_host *host)
>  	struct rcar_pcie *pcie = &host->pcie;
>  	struct pci_host_bridge *bridge = pci_host_bridge_from_priv(host);
>  	struct resource_entry *win;
> -	LIST_HEAD(res);
>  	int i = 0;

Internal Sashiko feedback while backporting this patch:

[Severity: High]
This is a pre-existing issue, but does this function lack bounds checking
for the outbound window index 'i' when configuring PCI resources?

Looking at the loop just below this hunk in rcar_pcie_hw_enable():

	resource_list_for_each_entry(win, &bridge->windows) {
		...
		switch (resource_type(res)) {
		case IORESOURCE_IO:
		case IORESOURCE_MEM:
			rcar_pcie_set_outbound(pcie, i, win);
			i++;
			break;
		}
	}

If the device tree populates bridge->windows with more ranges than the
supported outbound window limit (RCAR_PCI_MAX_RESOURCES, which is 4), it
appears 'i' could exceed the limit. Could this result in an out-of-bounds
hardware register write during the calculation of the register offset in
rcar_pcie_set_outbound()?

  parent reply	other threads:[~2026-10-02 23:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21  9:12 Prabhakar
2026-06-10 16:37 ` Manivannan Sadhasivam
2026-10-02 23:32 ` Bjorn Helgaas [this message]
2026-10-03  7:38   ` Marek Vasut

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=20261002233229.GA401322@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=fabrizio.castro.jz@renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=mani@kernel.org \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=prabhakar.csengg@gmail.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=robh@kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /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

all inboxes | Powered by JetHome®