aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_api.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/sch_api.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/sch_api.c')
-rw-r--r--net/sched/sch_api.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 3d8981fde301..d2daefcc205f 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -426,7 +426,8 @@ static int qdisc_dump_stab(struct sk_buff *skb, struct qdisc_size_table *stab)
426 nest = nla_nest_start(skb, TCA_STAB); 426 nest = nla_nest_start(skb, TCA_STAB);
427 if (nest == NULL) 427 if (nest == NULL)
428 goto nla_put_failure; 428 goto nla_put_failure;
429 NLA_PUT(skb, TCA_STAB_BASE, sizeof(stab->szopts), &stab->szopts); 429 if (nla_put(skb, TCA_STAB_BASE, sizeof(stab->szopts), &stab->szopts))
430 goto nla_put_failure;
430 nla_nest_end(skb, nest); 431 nla_nest_end(skb, nest);
431 432
432 return skb->len; 433 return skb->len;
@@ -1201,7 +1202,8 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid,
1201 tcm->tcm_parent = clid; 1202 tcm->tcm_parent = clid;
1202 tcm->tcm_handle = q->handle; 1203 tcm->tcm_handle = q->handle;
1203 tcm->tcm_info = atomic_read(&q->refcnt); 1204 tcm->tcm_info = atomic_read(&q->refcnt);
1204 NLA_PUT_STRING(skb, TCA_KIND, q->ops->id); 1205 if (nla_put_string(skb, TCA_KIND, q->ops->id))
1206 goto nla_put_failure;
1205 if (q->ops->dump && q->ops->dump(q, skb) < 0) 1207 if (q->ops->dump && q->ops->dump(q, skb) < 0)
1206 goto nla_put_failure; 1208 goto nla_put_failure;
1207 q->qstats.qlen = q->q.qlen; 1209 q->qstats.qlen = q->q.qlen;
@@ -1505,7 +1507,8 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q,
1505 tcm->tcm_parent = q->handle; 1507 tcm->tcm_parent = q->handle;
1506 tcm->tcm_handle = q->handle; 1508 tcm->tcm_handle = q->handle;
1507 tcm->tcm_info = 0; 1509 tcm->tcm_info = 0;
1508 NLA_PUT_STRING(skb, TCA_KIND, q->ops->id); 1510 if (nla_put_string(skb, TCA_KIND, q->ops->id))
1511 goto nla_put_failure;
1509 if (cl_ops->dump && cl_ops->dump(q, cl, skb, tcm) < 0) 1512 if (cl_ops->dump && cl_ops->dump(q, cl, skb, tcm) < 0)
1510 goto nla_put_failure; 1513 goto nla_put_failure;
1511 1514