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>
This commit is contained in:
@@ -601,7 +601,8 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl,
|
||||
if (nest == NULL)
|
||||
goto nla_put_failure;
|
||||
|
||||
NLA_PUT(skb, TCA_ATM_HDR, flow->hdr_len, flow->hdr);
|
||||
if (nla_put(skb, TCA_ATM_HDR, flow->hdr_len, flow->hdr))
|
||||
goto nla_put_failure;
|
||||
if (flow->vcc) {
|
||||
struct sockaddr_atmpvc pvc;
|
||||
int state;
|
||||
@@ -610,15 +611,19 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl,
|
||||
pvc.sap_addr.itf = flow->vcc->dev ? flow->vcc->dev->number : -1;
|
||||
pvc.sap_addr.vpi = flow->vcc->vpi;
|
||||
pvc.sap_addr.vci = flow->vcc->vci;
|
||||
NLA_PUT(skb, TCA_ATM_ADDR, sizeof(pvc), &pvc);
|
||||
if (nla_put(skb, TCA_ATM_ADDR, sizeof(pvc), &pvc))
|
||||
goto nla_put_failure;
|
||||
state = ATM_VF2VS(flow->vcc->flags);
|
||||
NLA_PUT_U32(skb, TCA_ATM_STATE, state);
|
||||
if (nla_put_u32(skb, TCA_ATM_STATE, state))
|
||||
goto nla_put_failure;
|
||||
}
|
||||
if (flow->excess) {
|
||||
if (nla_put_u32(skb, TCA_ATM_EXCESS, flow->classid))
|
||||
goto nla_put_failure;
|
||||
} else {
|
||||
if (nla_put_u32(skb, TCA_ATM_EXCESS, 0))
|
||||
goto nla_put_failure;
|
||||
}
|
||||
if (flow->excess)
|
||||
NLA_PUT_U32(skb, TCA_ATM_EXCESS, flow->classid);
|
||||
else
|
||||
NLA_PUT_U32(skb, TCA_ATM_EXCESS, 0);
|
||||
|
||||
nla_nest_end(skb, nest);
|
||||
return skb->len;
|
||||
|
||||
|
Reference in New Issue
Block a user