From: Saeed Mahameed <saeed@kernel.org>
To: Roi Dayan <roid@nvidia.com>, angkery <angkery@163.com>,
leon@kernel.org, davem@davemloft.net, kuba@kernel.org,
vladbu@nvidia.com, dlinkin@nvidia.com, dan.carpenter@oracle.com
Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org, Junlin Yang <yangjunlin@yulong.com>
Subject: Re: [PATCH] net/mlx5: use kvfree() for memory allocated with kvzalloc()
Date: Thu, 11 Mar 2021 15:26:56 -0800 [thread overview]
Message-ID: <bdfceaa00159629ea2dbcc30eaa8e4ece0c96021.camel@kernel.org> (raw)
In-Reply-To: <0c195a3a-53cc-dbd2-f656-54a92e5a569b@nvidia.com>
On Wed, 2021-03-03 at 09:54 +0200, Roi Dayan wrote:
>
>
> On 2021-03-03 4:40 AM, angkery wrote:
> > From: Junlin Yang <yangjunlin@yulong.com>
> >
> > It is allocated with kvzalloc(), the corresponding release function
> > should not be kfree(), use kvfree() instead.
> >
> > Generated by: scripts/coccinelle/api/kfree_mismatch.cocci
> >
> > Signed-off-by: Junlin Yang <yangjunlin@yulong.com>
> > ---
> > drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.c | 10
> > +++++-----
> > 1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git
> > a/drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.c
> > b/drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.c
> > index 6f6772b..3da7bec 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.c
> > @@ -248,7 +248,7 @@ static int mlx5_esw_indir_table_rule_get(struct
> > mlx5_eswitch *esw,
> > err_ethertype:
> > kfree(rule);
> > out:
> > - kfree(rule_spec);
> > + kvfree(rule_spec);
> > return err;
> > }
> >
> > @@ -328,7 +328,7 @@ static int
> > mlx5_create_indir_recirc_group(struct mlx5_eswitch *esw,
> > e->recirc_cnt = 0;
> >
> > out:
> > - kfree(in);
> > + kvfree(in);
> > return err;
> > }
> >
> > @@ -347,7 +347,7 @@ static int mlx5_create_indir_fwd_group(struct
> > mlx5_eswitch *esw,
> >
> > spec = kvzalloc(sizeof(*spec), GFP_KERNEL);
> > if (!spec) {
> > - kfree(in);
> > + kvfree(in);
> > return -ENOMEM;
> > }
> >
> > @@ -371,8 +371,8 @@ static int mlx5_create_indir_fwd_group(struct
> > mlx5_eswitch *esw,
> > }
> >
> > err_out:
> > - kfree(spec);
> > - kfree(in);
> > + kvfree(spec);
> > + kvfree(in);
> > return err;
> > }
> >
> >
>
> thanks!
>
> Reviewed-by: Roi Dayan <roid@nvidia.com>
>
applied to net-next-mlx5
prev parent reply other threads:[~2021-03-11 23:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-03 2:40 [PATCH] net/mlx5: use kvfree() for memory allocated with kvzalloc() angkery
2021-03-03 7:54 ` Roi Dayan
2021-03-11 23:26 ` Saeed Mahameed [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bdfceaa00159629ea2dbcc30eaa8e4ece0c96021.camel@kernel.org \
--to=saeed@kernel.org \
--cc=angkery@163.com \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=dlinkin@nvidia.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=roid@nvidia.com \
--cc=vladbu@nvidia.com \
--cc=yangjunlin@yulong.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox