public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/bng_re: Fix CREQ BAR base validity check in bng_re_map_creq_db
@ 2026-02-27 15:35 Alok Tiwari
  2026-03-02 10:22 ` Siva Reddy Kallam
  2026-03-04  9:52 ` Leon Romanovsky
  0 siblings, 2 replies; 3+ messages in thread
From: Alok Tiwari @ 2026-02-27 15:35 UTC (permalink / raw)
  To: usman.ansari, siva.kallam, leon, jgg, kalesh-anakkur.purayil,
	vikas.gupta, bhargava.marreddy, linux-rdma
  Cc: alok.a.tiwarilinux, alok.a.tiwari

bng_re_map_creq_db() initializes creq_db->reg.bar_id to the fixed BAR
index used for the CREQ doorbell, then reads the BAR start address via
pci_resource_start().

The existing code checked !bar_id, which is not a validity test for the
PCI resource start. Check !bar_base instead and log an error when the
BAR start address is 0.

Fixes: 4f830cd8d7fe ("RDMA/bng_re: Add infrastructure for enabling Firmware channel")
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
---
 drivers/infiniband/hw/bng_re/bng_fw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/bng_re/bng_fw.c b/drivers/infiniband/hw/bng_re/bng_fw.c
index 17d7cc3aa11d..92e7fa4dcf1a 100644
--- a/drivers/infiniband/hw/bng_re/bng_fw.c
+++ b/drivers/infiniband/hw/bng_re/bng_fw.c
@@ -581,7 +581,7 @@ static int bng_re_map_creq_db(struct bng_re_rcfw *rcfw, u32 reg_offt)
 	creq_db->dbinfo.flags = 0;
 	creq_db->reg.bar_id = BNG_FW_COMM_CONS_PCI_BAR_REGION;
 	creq_db->reg.bar_base = pci_resource_start(pdev, creq_db->reg.bar_id);
-	if (!creq_db->reg.bar_id)
+	if (!creq_db->reg.bar_base)
 		dev_err(&pdev->dev,
 			"CREQ BAR region %d resc start is 0!",
 			creq_db->reg.bar_id);
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/bng_re: Fix CREQ BAR base validity check in bng_re_map_creq_db
  2026-02-27 15:35 [PATCH] RDMA/bng_re: Fix CREQ BAR base validity check in bng_re_map_creq_db Alok Tiwari
@ 2026-03-02 10:22 ` Siva Reddy Kallam
  2026-03-04  9:52 ` Leon Romanovsky
  1 sibling, 0 replies; 3+ messages in thread
From: Siva Reddy Kallam @ 2026-03-02 10:22 UTC (permalink / raw)
  To: Alok Tiwari
  Cc: usman.ansari, leon, jgg, kalesh-anakkur.purayil, vikas.gupta,
	bhargava.marreddy, linux-rdma, alok.a.tiwarilinux

[-- Attachment #1: Type: text/plain, Size: 1512 bytes --]

On Fri, Feb 27, 2026 at 9:10 PM Alok Tiwari <alok.a.tiwari@oracle.com> wrote:
>
> bng_re_map_creq_db() initializes creq_db->reg.bar_id to the fixed BAR
> index used for the CREQ doorbell, then reads the BAR start address via
> pci_resource_start().
>
> The existing code checked !bar_id, which is not a validity test for the
> PCI resource start. Check !bar_base instead and log an error when the
> BAR start address is 0.
>
> Fixes: 4f830cd8d7fe ("RDMA/bng_re: Add infrastructure for enabling Firmware channel")
> Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
Reviewed-by: Siva Reddy Kallam <siva.kallam@broadcom.com>

> ---
>  drivers/infiniband/hw/bng_re/bng_fw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/hw/bng_re/bng_fw.c b/drivers/infiniband/hw/bng_re/bng_fw.c
> index 17d7cc3aa11d..92e7fa4dcf1a 100644
> --- a/drivers/infiniband/hw/bng_re/bng_fw.c
> +++ b/drivers/infiniband/hw/bng_re/bng_fw.c
> @@ -581,7 +581,7 @@ static int bng_re_map_creq_db(struct bng_re_rcfw *rcfw, u32 reg_offt)
>         creq_db->dbinfo.flags = 0;
>         creq_db->reg.bar_id = BNG_FW_COMM_CONS_PCI_BAR_REGION;
>         creq_db->reg.bar_base = pci_resource_start(pdev, creq_db->reg.bar_id);
> -       if (!creq_db->reg.bar_id)
> +       if (!creq_db->reg.bar_base)
>                 dev_err(&pdev->dev,
>                         "CREQ BAR region %d resc start is 0!",
>                         creq_db->reg.bar_id);
> --
> 2.50.1
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5471 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/bng_re: Fix CREQ BAR base validity check in bng_re_map_creq_db
  2026-02-27 15:35 [PATCH] RDMA/bng_re: Fix CREQ BAR base validity check in bng_re_map_creq_db Alok Tiwari
  2026-03-02 10:22 ` Siva Reddy Kallam
@ 2026-03-04  9:52 ` Leon Romanovsky
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2026-03-04  9:52 UTC (permalink / raw)
  To: Alok Tiwari
  Cc: usman.ansari, siva.kallam, jgg, kalesh-anakkur.purayil,
	vikas.gupta, bhargava.marreddy, linux-rdma, alok.a.tiwarilinux

On Fri, Feb 27, 2026 at 07:35:21AM -0800, Alok Tiwari wrote:
> bng_re_map_creq_db() initializes creq_db->reg.bar_id to the fixed BAR
> index used for the CREQ doorbell, then reads the BAR start address via
> pci_resource_start().
> 
> The existing code checked !bar_id, which is not a validity test for the
> PCI resource start. Check !bar_base instead and log an error when the
> BAR start address is 0.
> 
> Fixes: 4f830cd8d7fe ("RDMA/bng_re: Add infrastructure for enabling Firmware channel")
> Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
> ---
>  drivers/infiniband/hw/bng_re/bng_fw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/hw/bng_re/bng_fw.c b/drivers/infiniband/hw/bng_re/bng_fw.c
> index 17d7cc3aa11d..92e7fa4dcf1a 100644
> --- a/drivers/infiniband/hw/bng_re/bng_fw.c
> +++ b/drivers/infiniband/hw/bng_re/bng_fw.c
> @@ -581,7 +581,7 @@ static int bng_re_map_creq_db(struct bng_re_rcfw *rcfw, u32 reg_offt)
>  	creq_db->dbinfo.flags = 0;
>  	creq_db->reg.bar_id = BNG_FW_COMM_CONS_PCI_BAR_REGION;
>  	creq_db->reg.bar_base = pci_resource_start(pdev, creq_db->reg.bar_id);
> -	if (!creq_db->reg.bar_id)
> +	if (!creq_db->reg.bar_base)

Why is this check needed in the first place? The driver does nothing except
print an error message, which is unlikely to ever occur.

IMHO, you can remove it.

Thanks

>  		dev_err(&pdev->dev,
>  			"CREQ BAR region %d resc start is 0!",
>  			creq_db->reg.bar_id);
> -- 
> 2.50.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-04  9:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-27 15:35 [PATCH] RDMA/bng_re: Fix CREQ BAR base validity check in bng_re_map_creq_db Alok Tiwari
2026-03-02 10:22 ` Siva Reddy Kallam
2026-03-04  9:52 ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox