Re: [PATCH] net/mlx5: Use kfree(ft->g) in arfs_create_groups()

From: Eric Dumazet
Date: Fri Jun 05 2020 - 15:57:19 EST




On 6/5/20 12:22 PM, Denis Efremov wrote:
> Use kfree() instead of kvfree() on ft->g in arfs_create_groups() because
> the memory is allocated with kcalloc().
>
> Signed-off-by: Denis Efremov <efremov@xxxxxxxxx>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c
> index 014639ea06e3..c4c9d6cda7e6 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c
> @@ -220,7 +220,7 @@ static int arfs_create_groups(struct mlx5e_flow_table *ft,
> sizeof(*ft->g), GFP_KERNEL);
> in = kvzalloc(inlen, GFP_KERNEL);
> if (!in || !ft->g) {
> - kvfree(ft->g);
> + kfree(ft->g);
> kvfree(in);
> return -ENOMEM;
> }
>

This is slow path, kvfree() is perfectly able to free memory that was kmalloc()ed

net-next is closed, can we avoid these patches during merge window ?