Re: [EXTERNAL] [PATCH] RDMA/mana_ib: Ensure variable err is initialized

From: Leon Romanovsky
Date: Sun Feb 23 2025 - 06:28:43 EST


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@xxxxxxxxxxxx. 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@xxxxxxxxxxxx>
>
> I think it's an impossible condition, but the patch looks good to me.

Agree, it is impossible.

>
> Reviewed-by: Long Li <longli@xxxxxxxxxxxxx>

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
>