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_atm.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_atm.c')
-rw-r--r-- | net/sched/sch_atm.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c index e25e49061a0d..a77a4fbc069a 100644 --- a/net/sched/sch_atm.c +++ b/net/sched/sch_atm.c | |||
@@ -601,7 +601,8 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl, | |||
601 | if (nest == NULL) | 601 | if (nest == NULL) |
602 | goto nla_put_failure; | 602 | goto nla_put_failure; |
603 | 603 | ||
604 | NLA_PUT(skb, TCA_ATM_HDR, flow->hdr_len, flow->hdr); | 604 | if (nla_put(skb, TCA_ATM_HDR, flow->hdr_len, flow->hdr)) |
605 | goto nla_put_failure; | ||
605 | if (flow->vcc) { | 606 | if (flow->vcc) { |
606 | struct sockaddr_atmpvc pvc; | 607 | struct sockaddr_atmpvc pvc; |
607 | int state; | 608 | int state; |
@@ -610,15 +611,19 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl, | |||
610 | pvc.sap_addr.itf = flow->vcc->dev ? flow->vcc->dev->number : -1; | 611 | pvc.sap_addr.itf = flow->vcc->dev ? flow->vcc->dev->number : -1; |
611 | pvc.sap_addr.vpi = flow->vcc->vpi; | 612 | pvc.sap_addr.vpi = flow->vcc->vpi; |
612 | pvc.sap_addr.vci = flow->vcc->vci; | 613 | pvc.sap_addr.vci = flow->vcc->vci; |
613 | NLA_PUT(skb, TCA_ATM_ADDR, sizeof(pvc), &pvc); | 614 | if (nla_put(skb, TCA_ATM_ADDR, sizeof(pvc), &pvc)) |
615 | goto nla_put_failure; | ||
614 | state = ATM_VF2VS(flow->vcc->flags); | 616 | state = ATM_VF2VS(flow->vcc->flags); |
615 | NLA_PUT_U32(skb, TCA_ATM_STATE, state); | 617 | if (nla_put_u32(skb, TCA_ATM_STATE, state)) |
618 | goto nla_put_failure; | ||
619 | } | ||
620 | if (flow->excess) { | ||
621 | if (nla_put_u32(skb, TCA_ATM_EXCESS, flow->classid)) | ||
622 | goto nla_put_failure; | ||
623 | } else { | ||
624 | if (nla_put_u32(skb, TCA_ATM_EXCESS, 0)) | ||
625 | goto nla_put_failure; | ||
616 | } | 626 | } |
617 | if (flow->excess) | ||
618 | NLA_PUT_U32(skb, TCA_ATM_EXCESS, flow->classid); | ||
619 | else | ||
620 | NLA_PUT_U32(skb, TCA_ATM_EXCESS, 0); | ||
621 | |||
622 | nla_nest_end(skb, nest); | 627 | nla_nest_end(skb, nest); |
623 | return skb->len; | 628 | return skb->len; |
624 | 629 | ||