2022-11-08 13:28:28

by Mark Zhang

[permalink] [raw]
Subject: Re: [PATCH] net/mlx5e: Use kvfree() in mlx5e_accel_fs_tcp_create()

On 11/8/2022 9:04 PM, YueHaibing wrote:
> 'accel_tcp' is allocated by kzalloc(), which should freed by kvfree().

'accel_tcp' is allocated by kvzalloc()

>
> Fixes: f52f2faee581 ("net/mlx5e: Introduce flow steering API")
> Signed-off-by: YueHaibing <[email protected]>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
> index 285d32d2fd08..7843c60d5b99 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
> @@ -397,7 +397,7 @@ int mlx5e_accel_fs_tcp_create(struct mlx5e_flow_steering *fs)
> err_destroy_tables:
> while (--i >= 0)
> accel_fs_tcp_destroy_table(fs, i);
> - kfree(accel_tcp);
> + kvfree(accel_tcp);
> mlx5e_fs_set_accel_tcp(fs, NULL);
> return err;
> }

Need to fix mlx5e_accel_fs_tcp_destroy() as well?



2022-11-08 14:27:11

by Yue Haibing

[permalink] [raw]
Subject: Re: [PATCH] net/mlx5e: Use kvfree() in mlx5e_accel_fs_tcp_create()

On 2022/11/8 21:16, Mark Zhang wrote:
> On 11/8/2022 9:04 PM, YueHaibing wrote:
>> 'accel_tcp' is allocated by kzalloc(), which should freed by kvfree().
>
> 'accel_tcp' is allocated by kvzalloc()>
>>
>> Fixes: f52f2faee581 ("net/mlx5e: Introduce flow steering API")
>> Signed-off-by: YueHaibing <[email protected]>
>> ---
>>   drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
>> index 285d32d2fd08..7843c60d5b99 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
>> @@ -397,7 +397,7 @@ int mlx5e_accel_fs_tcp_create(struct mlx5e_flow_steering *fs)
>>   err_destroy_tables:
>>       while (--i >= 0)
>>           accel_fs_tcp_destroy_table(fs, i);
>> -    kfree(accel_tcp);
>> +    kvfree(accel_tcp);
>>       mlx5e_fs_set_accel_tcp(fs, NULL);
>>       return err;
>>   }
>
> Need to fix mlx5e_accel_fs_tcp_destroy() as well?

Indeed, thanks for your review.

>
> .