> -----Original Message-----
> From: Mahmoud Maatouq <mahmoudmatook...@gmail.com>
> Sent: Monday, June 24, 2024 21:10
> To: Dariusz Sosnowski <dsosnow...@nvidia.com>
> Cc: Slava Ovsiienko <viachesl...@nvidia.com>; Bing Zhao <bi...@nvidia.com>;
> Ori Kam <or...@nvidia.com>; Suanming Mou <suanmi...@nvidia.com>; Matan
> Azrad <ma...@nvidia.com>; dev@dpdk.org
> Subject: Re: [PATCH] net/mlx5: fix memleak for resource object
> 
> On 06/24, Dariusz Sosnowski wrote:
> 
> > Hi,
> >
> > Thank you very much for the fix.
> >
> > Could you please provide the commit message explaining the problem reported
> by Coverity and the fix?
> 
> I thought of doing that, but found Coverity report already explained it, so i 
> was
> afraid it could be redundant, but I'll add it as a quick explanation

Thank you. I'll review v2.

> >
> > > -----Original Message-----
> > > From: Mahmoud Maatuq <mahmoudmatook...@gmail.com>
> > > Sent: Sunday, June 23, 2024 12:36
> > > To: Dariusz Sosnowski <dsosnow...@nvidia.com>; Slava Ovsiienko
> > > <viachesl...@nvidia.com>; Bing Zhao <bi...@nvidia.com>; Ori Kam
> > > <or...@nvidia.com>; Suanming Mou <suanmi...@nvidia.com>; Matan
> Azrad
> > > <ma...@nvidia.com>
> > > Cc: dev@dpdk.org; Mahmoud Maatuq <mahmoudmatook...@gmail.com>
> > > Subject: [PATCH] net/mlx5: fix memleak for resource object
> > >
> > > Coverity issue: 426424
> > > Fixes: e78e5408da89 ("net/mlx5: remove cache term from the list
> > > utility")
> >
> > The issue was introduced in commit 27d171b88031 ("net/mlx5: abstract flow
> action and enable reconfigure").
> > Fixes tag should reference that commit.
> 
> how to get the proper commit that introduced the issue, as I used git blame 
> to get
> the above mentioned commit

I'd say that git blame for the code with the bug is a starting point.
The suspected commit (according to line number) should be verified if it really 
introduced the issue.
For example, in this patch:
- commit e78e5408da89 - modified the API for mlx5 list.
  It modified flow_dv_matcher_create_cb function but did not introduce the "if" 
with missing resource release.
- commit 27d171b88031 - introduced additional resource allocation and clean up 
was not covered in all code paths.

> 
> >
> > > Cc: ma...@nvidia.com
> > >
> > > Signed-off-by: Mahmoud Maatuq <mahmoudmatook...@gmail.com>
> > > ---
> > >  drivers/net/mlx5/mlx5_flow_dv.c | 5 ++++-
> > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> > > b/drivers/net/mlx5/mlx5_flow_dv.c index d46beffd4c..1010b8e423
> > > 100644
> > > --- a/drivers/net/mlx5/mlx5_flow_dv.c
> > > +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> > > @@ -12010,9 +12010,12 @@ flow_matcher_create_cb(void *tool_ctx, void
> > > *cb_ctx)
> > >                 items = *((const struct rte_flow_item **)(ctx->data2));
> > >                 resource->matcher_object = mlx5dr_bwc_matcher_create
> > >                                 (resource->group->tbl, 
> > > resource->priority, items);
> > > -               if (!(resource->matcher_object))
> > > +               if (!(resource->matcher_object)) {
> >
> > While we're at it, could you please remove the parentheses around resource-
> >matcher_object? They're redundant.
> >
> > > +                       mlx5_free(resource);
> > >                         return NULL;
> > > +               }
> > >  #else
> > > +               mlx5_free(resource);
> > >                 return NULL;
> > >  #endif
> > >         }
> > > --
> > > 2.43.0
> >
> > Best regards,
> > Dariusz Sosnowski
> >

Reply via email to