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/cls_tcindex.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/cls_tcindex.c')
-rw-r--r-- | net/sched/cls_tcindex.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index dbe199234c63..fe29420d0b0e 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c | |||
@@ -438,10 +438,11 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh, | |||
438 | 438 | ||
439 | if (!fh) { | 439 | if (!fh) { |
440 | t->tcm_handle = ~0; /* whatever ... */ | 440 | t->tcm_handle = ~0; /* whatever ... */ |
441 | NLA_PUT_U32(skb, TCA_TCINDEX_HASH, p->hash); | 441 | if (nla_put_u32(skb, TCA_TCINDEX_HASH, p->hash) || |
442 | NLA_PUT_U16(skb, TCA_TCINDEX_MASK, p->mask); | 442 | nla_put_u16(skb, TCA_TCINDEX_MASK, p->mask) || |
443 | NLA_PUT_U32(skb, TCA_TCINDEX_SHIFT, p->shift); | 443 | nla_put_u32(skb, TCA_TCINDEX_SHIFT, p->shift) || |
444 | NLA_PUT_U32(skb, TCA_TCINDEX_FALL_THROUGH, p->fall_through); | 444 | nla_put_u32(skb, TCA_TCINDEX_FALL_THROUGH, p->fall_through)) |
445 | goto nla_put_failure; | ||
445 | nla_nest_end(skb, nest); | 446 | nla_nest_end(skb, nest); |
446 | } else { | 447 | } else { |
447 | if (p->perfect) { | 448 | if (p->perfect) { |
@@ -460,8 +461,9 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh, | |||
460 | } | 461 | } |
461 | } | 462 | } |
462 | pr_debug("handle = %d\n", t->tcm_handle); | 463 | pr_debug("handle = %d\n", t->tcm_handle); |
463 | if (r->res.class) | 464 | if (r->res.class && |
464 | NLA_PUT_U32(skb, TCA_TCINDEX_CLASSID, r->res.classid); | 465 | nla_put_u32(skb, TCA_TCINDEX_CLASSID, r->res.classid)) |
466 | goto nla_put_failure; | ||
465 | 467 | ||
466 | if (tcf_exts_dump(skb, &r->exts, &tcindex_ext_map) < 0) | 468 | if (tcf_exts_dump(skb, &r->exts, &tcindex_ext_map) < 0) |
467 | goto nla_put_failure; | 469 | goto nla_put_failure; |