diff options
author | David S. Miller <davem@davemloft.net> | 2012-03-29 05:11:39 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-01 18:11:37 -0400 |
commit | 1b34ec43c9b3de44a5420841ab293d1b2035a94c (patch) | |
tree | 8d6cf966c813e0e61001655179b5ef8e5f1b54b3 /net/sched/act_police.c | |
parent | 9360ffd1859720f6520cf59241909b74dae369d0 (diff) |
pkt_sched: Stop using NLA_PUT*().
These macros contain a hidden goto, and are thus extremely error
prone and make code hard to audit.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_police.c')
-rw-r--r-- | net/sched/act_police.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/net/sched/act_police.c b/net/sched/act_police.c index 6fb3f5af0f85..a9de23297d47 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c | |||
@@ -356,11 +356,14 @@ tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | |||
356 | opt.rate = police->tcfp_R_tab->rate; | 356 | opt.rate = police->tcfp_R_tab->rate; |
357 | if (police->tcfp_P_tab) | 357 | if (police->tcfp_P_tab) |
358 | opt.peakrate = police->tcfp_P_tab->rate; | 358 | opt.peakrate = police->tcfp_P_tab->rate; |
359 | NLA_PUT(skb, TCA_POLICE_TBF, sizeof(opt), &opt); | 359 | if (nla_put(skb, TCA_POLICE_TBF, sizeof(opt), &opt)) |
360 | if (police->tcfp_result) | 360 | goto nla_put_failure; |
361 | NLA_PUT_U32(skb, TCA_POLICE_RESULT, police->tcfp_result); | 361 | if (police->tcfp_result && |
362 | if (police->tcfp_ewma_rate) | 362 | nla_put_u32(skb, TCA_POLICE_RESULT, police->tcfp_result)) |
363 | NLA_PUT_U32(skb, TCA_POLICE_AVRATE, police->tcfp_ewma_rate); | 363 | goto nla_put_failure; |
364 | if (police->tcfp_ewma_rate && | ||
365 | nla_put_u32(skb, TCA_POLICE_AVRATE, police->tcfp_ewma_rate)) | ||
366 | goto nla_put_failure; | ||
364 | return skb->len; | 367 | return skb->len; |
365 | 368 | ||
366 | nla_put_failure: | 369 | nla_put_failure: |