diff mbox series

net/mlx5e: Use kvfree() in mlx5e_accel_fs_tcp_create()

Message ID 20221108130411.6932-1-yuehaibing@huawei.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net/mlx5e: Use kvfree() in mlx5e_accel_fs_tcp_create() | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 11 of 11 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Yue Haibing Nov. 8, 2022, 1:04 p.m. UTC
'accel_tcp' is allocated by kzalloc(), which should freed by kvfree().

Fixes: f52f2faee581 ("net/mlx5e: Introduce flow steering API")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Zhang Nov. 8, 2022, 1:16 p.m. UTC | #1
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 <yuehaibing@huawei.com>
> ---
>   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?
Yue Haibing Nov. 8, 2022, 1:52 p.m. UTC | #2
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 <yuehaibing@huawei.com>
>> ---
>>   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.

> 
> .
diff mbox series

Patch

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;
 }