* [PATCH v2] PCI: rcar-host: Remove unused LIST_HEAD(res)
@ 2026-05-21 9:12 Prabhakar
2026-06-10 16:37 ` Manivannan Sadhasivam
2026-10-02 23:32 ` Bjorn Helgaas
0 siblings, 2 replies; 4+ messages in thread
From: Prabhakar @ 2026-05-21 9:12 UTC (permalink / raw)
To: Marek Vasut, Yoshihiro Shimoda, Manivannan Sadhasivam,
Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Geert Uytterhoeven, Magnus Damm
Cc: linux-pci, linux-renesas-soc, linux-kernel, Prabhakar, Biju Das,
Fabrizio Castro, Lad Prabhakar
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;
/* Try setting 5 GT/s link speed */
--
2.54.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI: rcar-host: Remove unused LIST_HEAD(res)
2026-05-21 9:12 [PATCH v2] PCI: rcar-host: Remove unused LIST_HEAD(res) Prabhakar
@ 2026-06-10 16:37 ` Manivannan Sadhasivam
2026-10-02 23:32 ` Bjorn Helgaas
1 sibling, 0 replies; 4+ messages in thread
From: Manivannan Sadhasivam @ 2026-06-10 16:37 UTC (permalink / raw)
To: Marek Vasut, Yoshihiro Shimoda, Lorenzo Pieralisi,
Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas,
Geert Uytterhoeven, Magnus Damm, Prabhakar
Cc: linux-pci, linux-renesas-soc, linux-kernel, Biju Das,
Fabrizio Castro, Lad Prabhakar
On Thu, 21 May 2026 10:12:56 +0100, Prabhakar wrote:
> 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:
>
> [...]
Applied, thanks!
[1/1] PCI: rcar-host: Remove unused LIST_HEAD(res)
commit: 6ba90ce2069ae923b0ec787aebdf2d786e5d2a58
Best regards,
--
Manivannan Sadhasivam <mani@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI: rcar-host: Remove unused LIST_HEAD(res)
2026-05-21 9:12 [PATCH v2] PCI: rcar-host: Remove unused LIST_HEAD(res) Prabhakar
2026-06-10 16:37 ` Manivannan Sadhasivam
@ 2026-10-02 23:32 ` Bjorn Helgaas
2026-10-03 7:38 ` Marek Vasut
1 sibling, 1 reply; 4+ messages in thread
From: Bjorn Helgaas @ 2026-10-02 23:32 UTC (permalink / raw)
To: Prabhakar
Cc: Marek Vasut, Yoshihiro Shimoda, Manivannan Sadhasivam,
Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Geert Uytterhoeven, Magnus Damm, linux-pci,
linux-renesas-soc, linux-kernel, Biju Das, Fabrizio Castro,
Lad Prabhakar
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()?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI: rcar-host: Remove unused LIST_HEAD(res)
2026-10-02 23:32 ` Bjorn Helgaas
@ 2026-10-03 7:38 ` Marek Vasut
0 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2026-10-03 7:38 UTC (permalink / raw)
To: Bjorn Helgaas, Prabhakar
Cc: Marek Vasut, Yoshihiro Shimoda, Manivannan Sadhasivam,
Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Geert Uytterhoeven, Magnus Damm, linux-pci,
linux-renesas-soc, linux-kernel, Biju Das, Fabrizio Castro,
Lad Prabhakar
On 10/3/26 1:32 AM, Bjorn Helgaas wrote:
> 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?
I believe this is addressed in
[PATCH] PCI: rcar-host: Validate IO/MEM resource count in DT ranges property
Thank you.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-03 7:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-21 9:12 [PATCH v2] PCI: rcar-host: Remove unused LIST_HEAD(res) Prabhakar
2026-06-10 16:37 ` Manivannan Sadhasivam
2026-10-02 23:32 ` Bjorn Helgaas
2026-10-03 7:38 ` Marek Vasut
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®