net/sched/act_simple.c | 1 - 1 file changed, 1 deletion(-)
The call to nla_strscpy() already zero-pads the tail of the destination
buffer which makes the additional memset(0) call redundant. Remove it.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
net/sched/act_simple.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c
index f3abe0545989..8e69a919b4fe 100644
--- a/net/sched/act_simple.c
+++ b/net/sched/act_simple.c
@@ -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.50.1
On Mon, Aug 11, 2025 at 06:40:38PM +0200, Thorsten Blum 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. > > Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> > --- > net/sched/act_simple.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c > index f3abe0545989..8e69a919b4fe 100644 > --- a/net/sched/act_simple.c > +++ b/net/sched/act_simple.c > @@ -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) Reviewed-by: Joe Damato <joe@dama.to>
© 2016 - 2025 Red Hat, Inc.