Skip to contentSkip to conversation

net/sched: Remove redundant memset(0) call in reset_policy()

PATCH Applied Thorsten Blum 3 participants 3 messages Aug 11, 2025 – Aug 13, 2025

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

PATCH 1/1 net/sched: Remove redundant memset(0) call in reset_policy()

The call to nla_strscpy() already zero-pads the tail of the destination buffer which makes the additional memset(0) call redundant. Remove it.

---
 net/sched/act_simple.c | 1 -
 1 file changed, 1 deletion(-)
net/sched/act_simple.c +0 -1
index f3abe0545989..8e69a919b4fe 100644
@@ -72,7 +72,6 @@ static int reset_policy(struct tc_action *a, const struct nlattr *defdata,
 	d = to_defact(a);
 	spin_lock_bh(&d->tcf_lock);
 	goto_ch = tcf_action_set_ctrlact(a, p->action, goto_ch);
-	memset(d->tcfd_defdata, 0, SIMP_MAX_DATA);
 	nla_strscpy(d->tcfd_defdata, defdata, SIMP_MAX_DATA);
 	spin_unlock_bh(&d->tcf_lock);
 	if (goto_ch)
Signature · 1 line
2.50.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Thorsten Blum

The call to nla_strscpy() already zero-pads the tail of the destination buffer which makes the additional memset(0) call redundant. Remove it.

---
 net/sched/act_simple.c | 1 -
 1 file changed, 1 deletion(-)
net/sched/act_simple.c +0 -0
index f3abe0545989..8e69a919b4fe 100644

net/sched/act_simple.c static int reset_policy(struct tc_action *a, const struct nlattr *defdata, · line 77

Quoted 7 lines
net/sched/act_simple.c +0 -1
@@ -72,7 +72,6 @@ static int reset_policy(struct tc_action *a, const struct nlattr *defdata,
 	d = to_defact(a);
 	spin_lock_bh(&d->tcf_lock);
 	goto_ch = tcf_action_set_ctrlact(a, p->action, goto_ch);
-	memset(d->tcfd_defdata, 0, SIMP_MAX_DATA);
 	nla_strscpy(d->tcfd_defdata, defdata, SIMP_MAX_DATA);
 	spin_unlock_bh(&d->tcf_lock);
 	if (goto_ch)
#2 lore raw
In reply to Thorsten Blum
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 7 lines · On Mon, 11 Aug 2025 18:40:38 +0200 you wrote:

The call to nla_strscpy() already zero-pads the tail of the destination buffer which makes the additional memset(0) call redundant. Remove it.

---
 net/sched/act_simple.c | 1 -
 1 file changed, 1 deletion(-)

Here is the summary with links:
- [net-next] net/sched: Remove redundant memset(0) call in reset_policy()

    https://git.kernel.org/netdev/net-next/c/b3ba7d929ce1

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html