Skip to contentSkip to conversation

net/mlx5: Remove redundant memset after kvzalloc

PATCH In review Sang-Heon Jeon 4 participants 5 messages Oct 12 – Oct 20

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: Remove redundant memset after kvzalloc

kvzalloc() returns zeroed memory, so the memset after the allocation in mlx5e_post_meter_create_mtu_table() and macsec_fs_tx_create() is redundant.

So remove the memset.

No functional change.

---
 drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_meter.c | 1 -
 drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c    | 1 -
 2 files changed, 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_meter.c +0 -1
index d03376d7bb31..fcbd464c5539 100644
@@ -310,7 +310,6 @@ mlx5e_post_meter_create_mtu_table(struct mlx5e_priv *priv,
 	}
 
 	/* create miss group */
-	memset(flow_group_in, 0, inlen);
 	MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, 1);
 	MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, 1);
 	fg = mlx5_create_flow_group(table->ft, flow_group_in);
drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c +0 -1
index efc5167493c1..12af812a1e19 100644
@@ -476,7 +476,6 @@ static int macsec_fs_tx_create(struct mlx5_macsec_fs *macsec_fs)
 	tx_tables->ft_check = flow_table;
 
 	/* Tx check table Default miss group/rule */
-	memset(flow_group_in, 0, inlen);
 	MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, flow_table->max_fte - 1);
 	MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, flow_table->max_fte - 1);
 	flow_group = mlx5_create_flow_group(tx_tables->ft_check, flow_group_in);

base-commit: d8674294aefef02266c4d47ad10131f1bffbe534

Signature · 1 line
2.43.0
#1 lore raw
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 9 lines

kvzalloc() returns zeroed memory, so the memset after the allocation in mlx5e_post_meter_create_mtu_table() and macsec_fs_tx_create() is redundant.

So remove the memset.

No functional change.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Sang-Heon Jeon
Quoted 9 lines · Sang-Heon Jeon

kvzalloc() returns zeroed memory, so the memset after the allocation in mlx5e_post_meter_create_mtu_table() and macsec_fs_tx_create() is redundant.

So remove the memset.

No functional change.

Hi Sang-Heon,

I'm not sure if the value this cleanup brings is worth the churn. But I do believe it is correct.

maintainer Reviewed-by
#3 lore raw
Quoted 7 lines · Simon Horman
Quoted 6 lines · Sang-Heon Jeon

kvzalloc() returns zeroed memory, so the memset after the allocation in mlx5e_post_meter_create_mtu_table() and macsec_fs_tx_create() is redundant.

So remove the memset.

Quoted 7 lines
Quoted 3 lines

No functional change.

Hi Sang-Heon,

I'm not sure if the value this cleanup brings is worth the churn.

Exactly!

Quoted 3 lines

But I do believe it is correct.

Anyway,

#4 lore raw

Hi, Simon and Tariq

2026년 10월 20일 (화) 오전 3:44, Tariq Toukan <[email protected]>님이 작성:

Quoted 13 lines · Simon Horman
Quoted 9 lines · Sang-Heon Jeon
Quoted 8 lines

kvzalloc() returns zeroed memory, so the memset after the allocation in mlx5e_post_meter_create_mtu_table() and macsec_fs_tx_create() is redundant.

So remove the memset.

No functional change.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Hi Sang-Heon,

I'm not sure if the value this cleanup brings is worth the churn.

Exactly!

Fair enough. I do believe this patch can be helpful to future readers. But I fully respect the community and other people's resources. So just let me know if you don't want to see this kind of patch later. I'll keep that in my mind.

Quoted 7 lines
Quoted 3 lines

But I do believe it is correct.

Anyway,

Thanks for the review :)

Best regards
Sang-Heon Jeon