aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/cls_route.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/cls_route.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/cls_route.c')
-rw-r--r--net/sched/cls_route.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index 13ab66e9df58..36fec4227401 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -571,17 +571,21 @@ static int route4_dump(struct tcf_proto *tp, unsigned long fh,
571 571
572 if (!(f->handle & 0x8000)) { 572 if (!(f->handle & 0x8000)) {
573 id = f->id & 0xFF; 573 id = f->id & 0xFF;
574 NLA_PUT_U32(skb, TCA_ROUTE4_TO, id); 574 if (nla_put_u32(skb, TCA_ROUTE4_TO, id))
575 goto nla_put_failure;
575 } 576 }
576 if (f->handle & 0x80000000) { 577 if (f->handle & 0x80000000) {
577 if ((f->handle >> 16) != 0xFFFF) 578 if ((f->handle >> 16) != 0xFFFF &&
578 NLA_PUT_U32(skb, TCA_ROUTE4_IIF, f->iif); 579 nla_put_u32(skb, TCA_ROUTE4_IIF, f->iif))
580 goto nla_put_failure;
579 } else { 581 } else {
580 id = f->id >> 16; 582 id = f->id >> 16;
581 NLA_PUT_U32(skb, TCA_ROUTE4_FROM, id); 583 if (nla_put_u32(skb, TCA_ROUTE4_FROM, id))
584 goto nla_put_failure;
582 } 585 }
583 if (f->res.classid) 586 if (f->res.classid &&
584 NLA_PUT_U32(skb, TCA_ROUTE4_CLASSID, f->res.classid); 587 nla_put_u32(skb, TCA_ROUTE4_CLASSID, f->res.classid))
588 goto nla_put_failure;
585 589
586 if (tcf_exts_dump(skb, &f->exts, &route_ext_map) < 0) 590 if (tcf_exts_dump(skb, &f->exts, &route_ext_map) < 0)
587 goto nla_put_failure; 591 goto nla_put_failure;