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/sch_dsmark.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/sch_dsmark.c')
-rw-r--r-- | net/sched/sch_dsmark.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c index 2c790204d042..389b856c6653 100644 --- a/net/sched/sch_dsmark.c +++ b/net/sched/sch_dsmark.c | |||
@@ -429,8 +429,9 @@ static int dsmark_dump_class(struct Qdisc *sch, unsigned long cl, | |||
429 | opts = nla_nest_start(skb, TCA_OPTIONS); | 429 | opts = nla_nest_start(skb, TCA_OPTIONS); |
430 | if (opts == NULL) | 430 | if (opts == NULL) |
431 | goto nla_put_failure; | 431 | goto nla_put_failure; |
432 | NLA_PUT_U8(skb, TCA_DSMARK_MASK, p->mask[cl - 1]); | 432 | if (nla_put_u8(skb, TCA_DSMARK_MASK, p->mask[cl - 1]) || |
433 | NLA_PUT_U8(skb, TCA_DSMARK_VALUE, p->value[cl - 1]); | 433 | nla_put_u8(skb, TCA_DSMARK_VALUE, p->value[cl - 1])) |
434 | goto nla_put_failure; | ||
434 | 435 | ||
435 | return nla_nest_end(skb, opts); | 436 | return nla_nest_end(skb, opts); |
436 | 437 | ||
@@ -447,13 +448,16 @@ static int dsmark_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
447 | opts = nla_nest_start(skb, TCA_OPTIONS); | 448 | opts = nla_nest_start(skb, TCA_OPTIONS); |
448 | if (opts == NULL) | 449 | if (opts == NULL) |
449 | goto nla_put_failure; | 450 | goto nla_put_failure; |
450 | NLA_PUT_U16(skb, TCA_DSMARK_INDICES, p->indices); | 451 | if (nla_put_u16(skb, TCA_DSMARK_INDICES, p->indices)) |
452 | goto nla_put_failure; | ||
451 | 453 | ||
452 | if (p->default_index != NO_DEFAULT_INDEX) | 454 | if (p->default_index != NO_DEFAULT_INDEX && |
453 | NLA_PUT_U16(skb, TCA_DSMARK_DEFAULT_INDEX, p->default_index); | 455 | nla_put_u16(skb, TCA_DSMARK_DEFAULT_INDEX, p->default_index)) |
456 | goto nla_put_failure; | ||
454 | 457 | ||
455 | if (p->set_tc_index) | 458 | if (p->set_tc_index && |
456 | NLA_PUT_FLAG(skb, TCA_DSMARK_SET_TC_INDEX); | 459 | nla_put_flag(skb, TCA_DSMARK_SET_TC_INDEX)) |
460 | goto nla_put_failure; | ||
457 | 461 | ||
458 | return nla_nest_end(skb, opts); | 462 | return nla_nest_end(skb, opts); |
459 | 463 | ||