diff mbox series

RDMA/mana_ib: Ensure variable err is initialized

Message ID 20250221195833.7516C16290A@bout3.ijzerbout.nl (mailing list archive)
State Accepted
Headers show
Series RDMA/mana_ib: Ensure variable err is initialized | expand

Commit Message

Kees Bakker Feb. 21, 2025, 7:39 p.m. UTC
In the function mana_ib_gd_create_dma_region if there are no dma blocks
to process the variable `err` remains uninitialized.

Fixes: 0266a177631d ("RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter")
Signed-off-by: Kees Bakker <kees@ijzerbout.nl>
---
 drivers/infiniband/hw/mana/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Long Li Feb. 21, 2025, 8:34 p.m. UTC | #1
> Subject: [EXTERNAL] [PATCH] RDMA/mana_ib: Ensure variable err is initialized
> 
> [Some people who received this message don't often get email from
> kees@ijzerbout.nl. Learn why this is important at
> https://aka.ms/LearnAboutSenderIdentification ]
> 
> In the function mana_ib_gd_create_dma_region if there are no dma blocks to
> process the variable `err` remains uninitialized.
> 
> Fixes: 0266a177631d ("RDMA/mana_ib: Add a driver for Microsoft Azure
> Network Adapter")
> Signed-off-by: Kees Bakker <kees@ijzerbout.nl>

I think it's an impossible condition, but the patch looks good to me.

Reviewed-by: Long Li <longli@microsoft.com>

> ---
>  drivers/infiniband/hw/mana/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/hw/mana/main.c
> b/drivers/infiniband/hw/mana/main.c
> index 114ca8c509ce..eda9c5b971de 100644
> --- a/drivers/infiniband/hw/mana/main.c
> +++ b/drivers/infiniband/hw/mana/main.c
> @@ -384,7 +384,7 @@ static int mana_ib_gd_create_dma_region(struct
> mana_ib_dev *dev, struct ib_umem
>         unsigned int tail = 0;
>         u64 *page_addr_list;
>         void *request_buf;
> -       int err;
> +       int err = 0;
> 
>         gc = mdev_to_gc(dev);
>         hwc = gc->hwc.driver_data;
> --
> 2.48.1
Leon Romanovsky Feb. 23, 2025, 11:28 a.m. UTC | #2
On Fri, Feb 21, 2025 at 08:34:43PM +0000, Long Li wrote:
> > Subject: [EXTERNAL] [PATCH] RDMA/mana_ib: Ensure variable err is initialized
> > 
> > [Some people who received this message don't often get email from
> > kees@ijzerbout.nl. Learn why this is important at
> > https://aka.ms/LearnAboutSenderIdentification ]
> > 
> > In the function mana_ib_gd_create_dma_region if there are no dma blocks to
> > process the variable `err` remains uninitialized.
> > 
> > Fixes: 0266a177631d ("RDMA/mana_ib: Add a driver for Microsoft Azure
> > Network Adapter")
> > Signed-off-by: Kees Bakker <kees@ijzerbout.nl>
> 
> I think it's an impossible condition, but the patch looks good to me.

Agree, it is impossible.

> 
> Reviewed-by: Long Li <longli@microsoft.com>

Thanks

> 
> > ---
> >  drivers/infiniband/hw/mana/main.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/infiniband/hw/mana/main.c
> > b/drivers/infiniband/hw/mana/main.c
> > index 114ca8c509ce..eda9c5b971de 100644
> > --- a/drivers/infiniband/hw/mana/main.c
> > +++ b/drivers/infiniband/hw/mana/main.c
> > @@ -384,7 +384,7 @@ static int mana_ib_gd_create_dma_region(struct
> > mana_ib_dev *dev, struct ib_umem
> >         unsigned int tail = 0;
> >         u64 *page_addr_list;
> >         void *request_buf;
> > -       int err;
> > +       int err = 0;
> > 
> >         gc = mdev_to_gc(dev);
> >         hwc = gc->hwc.driver_data;
> > --
> > 2.48.1
>
Leon Romanovsky Feb. 23, 2025, 11:28 a.m. UTC | #3
On Fri, 21 Feb 2025 20:39:03 +0100, Kees Bakker wrote:
> In the function mana_ib_gd_create_dma_region if there are no dma blocks
> to process the variable `err` remains uninitialized.
> 
> 

Applied, thanks!

[1/1] RDMA/mana_ib: Ensure variable err is initialized
      https://git.kernel.org/rdma/rdma/c/be35a3127d6096

Best regards,
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/mana/main.c b/drivers/infiniband/hw/mana/main.c
index 114ca8c509ce..eda9c5b971de 100644
--- a/drivers/infiniband/hw/mana/main.c
+++ b/drivers/infiniband/hw/mana/main.c
@@ -384,7 +384,7 @@  static int mana_ib_gd_create_dma_region(struct mana_ib_dev *dev, struct ib_umem
 	unsigned int tail = 0;
 	u64 *page_addr_list;
 	void *request_buf;
-	int err;
+	int err = 0;
 
 	gc = mdev_to_gc(dev);
 	hwc = gc->hwc.driver_data;