net: sched: act_police: fix sparse errors in tcf_police_dump()
Subsystems (3)
PATCH 1/1 net: sched: act_police: fix sparse errors in tcf_police_dump()
Fixes following sparse errors:
net/sched/act_police.c:360:28: warning: dereference of noderef expression net/sched/act_police.c:362:45: warning: dereference of noderef expression net/sched/act_police.c:362:45: warning: dereference of noderef expression net/sched/act_police.c:368:28: warning: dereference of noderef expression net/sched/act_police.c:370:45: warning: dereference of noderef expression net/sched/act_police.c:370:45: warning: dereference of noderef expression net/sched/act_police.c:376:45: warning: dereference of noderef expression net/sched/act_police.c:376:45: warning: dereference of noderef expression
--- net/sched/act_police.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/sched/act_police.c +5 -5
@@ -357,23 +357,23 @@ static int tcf_police_dump(struct sk_buff *skb, struct tc_action *a, opt.burst =PSCHED_NS2TICKS (p->tcfp_burst);if (p->rate_present) {psched_ratecfg_getrate (&opt.rate, &p->rate); -if ((police->params->rate.rate_bytes_ps >= (1ULL <<32 )) && +if ((p->rate.rate_bytes_ps >= (1ULL <<32 )) &&nla_put_u64_64bit (skb,TCA_POLICE_RATE64 , - police->params->rate.rate_bytes_ps, + p->rate.rate_bytes_ps,TCA_POLICE_PAD )) goto nla_put_failure; }if (p->peak_present) {psched_ratecfg_getrate (&opt.peakrate, &p->peak); -if ((police->params->peak.rate_bytes_ps >= (1ULL <<32 )) && +if ((p->peak.rate_bytes_ps >= (1ULL <<32 )) &&nla_put_u64_64bit (skb,TCA_POLICE_PEAKRATE64 , - police->params->peak.rate_bytes_ps, + p->peak.rate_bytes_ps,TCA_POLICE_PAD )) goto nla_put_failure; }if (p->pps_present) {if (nla_put_u64_64bit (skb,TCA_POLICE_PKTRATE64 , - police->params->ppsrate.rate_pkts_ps, + p->ppsrate.rate_pkts_ps,TCA_POLICE_PAD )) goto nla_put_failure; if (nla_put_u64_64bit(skb, TCA_POLICE_PKTBURST64,
Signature · 1 line
2.41.0.rc0.172.g3f132b7071-goog
Quoted 11 lines · Eric Dumazet
Fixes following sparse errors:
net/sched/act_police.c:360:28: warning: dereference of noderef expressionnet/sched/act_police.c:362:45: warning: dereference of noderef expressionnet/sched/act_police.c:362:45: warning: dereference of noderef expressionnet/sched/act_police.c:368:28: warning: dereference of noderef expressionnet/sched/act_police.c:370:45: warning: dereference of noderef expressionnet/sched/act_police.c:370:45: warning: dereference of noderef expressionnet/sched/act_police.c:376:45: warning: dereference of noderef expressionnet/sched/act_police.c:376:45: warning: dereference of noderef expression
Quoted 2 lines
Fixes d1967e495a8d ("net_sched: act_police: add 2 new attributes to support police 64bit rate and peakrate")Signed-off-by Eric Dumazet <[email protected]>
Quoted 13 lines · Simon Horman
Quoted 11 lines · Eric Dumazet
Fixes following sparse errors:
net/sched/act_police.c:360:28: warning: dereference of noderef expressionnet/sched/act_police.c:362:45: warning: dereference of noderef expressionnet/sched/act_police.c:362:45: warning: dereference of noderef expressionnet/sched/act_police.c:368:28: warning: dereference of noderef expressionnet/sched/act_police.c:370:45: warning: dereference of noderef expressionnet/sched/act_police.c:370:45: warning: dereference of noderef expressionnet/sched/act_police.c:376:45: warning: dereference of noderef expressionnet/sched/act_police.c:376:45: warning: dereference of noderef expression
Quoted 4 lines
Quoted 2 lines
Fixes d1967e495a8d ("net_sched: act_police: add 2 new attributes to support police 64bit rate and peakrate")Signed-off-by Eric Dumazet <[email protected]>Reviewed-by Simon Horman <[email protected]>
Trivial comment: Eric, for completion, does it make sense to also convert opt.action = police->tcf_action to opt.action = p->tcf_action; and moving it after p = rcu_dereference_protected()?
cheers,
jamal
Quoted 18 lines · Jamal Hadi Salim
Quoted 16 lines · Simon Horman
Quoted 13 lines · Eric Dumazet
Fixes following sparse errors:
net/sched/act_police.c:360:28: warning: dereference of noderef expressionnet/sched/act_police.c:362:45: warning: dereference of noderef expressionnet/sched/act_police.c:362:45: warning: dereference of noderef expressionnet/sched/act_police.c:368:28: warning: dereference of noderef expressionnet/sched/act_police.c:370:45: warning: dereference of noderef expressionnet/sched/act_police.c:370:45: warning: dereference of noderef expressionnet/sched/act_police.c:376:45: warning: dereference of noderef expressionnet/sched/act_police.c:376:45: warning: dereference of noderef expressionFixes d1967e495a8d ("net_sched: act_police: add 2 new attributes to support police 64bit rate and peakrate")Signed-off-by Eric Dumazet <[email protected]>
Quoted 8 lines
Quoted 1 line
Reviewed-by Simon Horman <[email protected]>Acked-by Jamal Hadi Salim <[email protected]>Trivial comment: Eric, for completion, does it make sense to also convert opt.action =
police->tcf_actionto opt.action =p->tcf_action; and moving it after p =rcu_dereference_protected()?
Not sure I understand, tcf_action is in police->tcf_action, not in p->tcf_action ?
Field is read after spin_lock_bh(&police->tcf_lock); so the current code seems fine to me.
Jamal Hadi Salim
maintainerQuoted 29 lines · Eric Dumazet
Quoted 18 lines · Jamal Hadi Salim
Quoted 16 lines · Simon Horman
Quoted 13 lines · Eric Dumazet
Fixes following sparse errors:
net/sched/act_police.c:360:28: warning: dereference of noderef expressionnet/sched/act_police.c:362:45: warning: dereference of noderef expressionnet/sched/act_police.c:362:45: warning: dereference of noderef expressionnet/sched/act_police.c:368:28: warning: dereference of noderef expressionnet/sched/act_police.c:370:45: warning: dereference of noderef expressionnet/sched/act_police.c:370:45: warning: dereference of noderef expressionnet/sched/act_police.c:376:45: warning: dereference of noderef expressionnet/sched/act_police.c:376:45: warning: dereference of noderef expressionFixes d1967e495a8d ("net_sched: act_police: add 2 new attributes to support police 64bit rate and peakrate")Signed-off-by Eric Dumazet <[email protected]>Quoted 8 lines
Quoted 1 line
Reviewed-by Simon Horman <[email protected]>Acked-by Jamal Hadi Salim <[email protected]>Trivial comment: Eric, for completion, does it make sense to also convert opt.action =
police->tcf_actionto opt.action =p->tcf_action; and moving it after p =rcu_dereference_protected()?
Quoted 5 lines
Not sure I understand,
tcf_actionis inpolice->tcf_action, not inp->tcf_action?Field is read after
spin_lock_bh(&police->tcf_lock); so the current code seems fine to me.
Never mind - you are correct.
cheers,
jamal
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:
Quoted 11 lines · On Tue, 6 Jun 2023 13:13:04 +0000 you wrote:
Fixes following sparse errors:
net/sched/act_police.c:360:28: warning: dereference of noderef expressionnet/sched/act_police.c:362:45: warning: dereference of noderef expressionnet/sched/act_police.c:362:45: warning: dereference of noderef expressionnet/sched/act_police.c:368:28: warning: dereference of noderef expressionnet/sched/act_police.c:370:45: warning: dereference of noderef expressionnet/sched/act_police.c:370:45: warning: dereference of noderef expressionnet/sched/act_police.c:376:45: warning: dereference of noderef expressionnet/sched/act_police.c:376:45: warning: dereference of noderef expression
Quoted 1 line
[...]
Here is the summary with links:
- [net] net: sched: act_police: fix sparse errors in tcf_police_dump()
https://git.kernel.org/netdev/net/c/682881ee45c8
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html