aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_ipt.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-03-29 05:11:39 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-01 18:11:37 -0400
commit1b34ec43c9b3de44a5420841ab293d1b2035a94c (patch)
tree8d6cf966c813e0e61001655179b5ef8e5f1b54b3 /net/sched/act_ipt.c
parent9360ffd1859720f6520cf59241909b74dae369d0 (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_ipt.c')
-rw-r--r--net/sched/act_ipt.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index 60f8f616e8fa..0beba0e5312e 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -267,15 +267,17 @@ static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, int
267 c.refcnt = ipt->tcf_refcnt - ref; 267 c.refcnt = ipt->tcf_refcnt - ref;
268 strcpy(t->u.user.name, ipt->tcfi_t->u.kernel.target->name); 268 strcpy(t->u.user.name, ipt->tcfi_t->u.kernel.target->name);
269 269
270 NLA_PUT(skb, TCA_IPT_TARG, ipt->tcfi_t->u.user.target_size, t); 270 if (nla_put(skb, TCA_IPT_TARG, ipt->tcfi_t->u.user.target_size, t) ||
271 NLA_PUT_U32(skb, TCA_IPT_INDEX, ipt->tcf_index); 271 nla_put_u32(skb, TCA_IPT_INDEX, ipt->tcf_index) ||
272 NLA_PUT_U32(skb, TCA_IPT_HOOK, ipt->tcfi_hook); 272 nla_put_u32(skb, TCA_IPT_HOOK, ipt->tcfi_hook) ||
273 NLA_PUT(skb, TCA_IPT_CNT, sizeof(struct tc_cnt), &c); 273 nla_put(skb, TCA_IPT_CNT, sizeof(struct tc_cnt), &c) ||
274 NLA_PUT_STRING(skb, TCA_IPT_TABLE, ipt->tcfi_tname); 274 nla_put_string(skb, TCA_IPT_TABLE, ipt->tcfi_tname))
275 goto nla_put_failure;
275 tm.install = jiffies_to_clock_t(jiffies - ipt->tcf_tm.install); 276 tm.install = jiffies_to_clock_t(jiffies - ipt->tcf_tm.install);
276 tm.lastuse = jiffies_to_clock_t(jiffies - ipt->tcf_tm.lastuse); 277 tm.lastuse = jiffies_to_clock_t(jiffies - ipt->tcf_tm.lastuse);
277 tm.expires = jiffies_to_clock_t(ipt->tcf_tm.expires); 278 tm.expires = jiffies_to_clock_t(ipt->tcf_tm.expires);
278 NLA_PUT(skb, TCA_IPT_TM, sizeof (tm), &tm); 279 if (nla_put(skb, TCA_IPT_TM, sizeof (tm), &tm))
280 goto nla_put_failure;
279 kfree(t); 281 kfree(t);
280 return skb->len; 282 return skb->len;
281 283