aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/cls_rsvp.h
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_rsvp.h
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_rsvp.h')
-rw-r--r--net/sched/cls_rsvp.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h
index b01427924f81..18ab93ec8d7e 100644
--- a/net/sched/cls_rsvp.h
+++ b/net/sched/cls_rsvp.h
@@ -615,18 +615,22 @@ static int rsvp_dump(struct tcf_proto *tp, unsigned long fh,
615 if (nest == NULL) 615 if (nest == NULL)
616 goto nla_put_failure; 616 goto nla_put_failure;
617 617
618 NLA_PUT(skb, TCA_RSVP_DST, sizeof(s->dst), &s->dst); 618 if (nla_put(skb, TCA_RSVP_DST, sizeof(s->dst), &s->dst))
619 goto nla_put_failure;
619 pinfo.dpi = s->dpi; 620 pinfo.dpi = s->dpi;
620 pinfo.spi = f->spi; 621 pinfo.spi = f->spi;
621 pinfo.protocol = s->protocol; 622 pinfo.protocol = s->protocol;
622 pinfo.tunnelid = s->tunnelid; 623 pinfo.tunnelid = s->tunnelid;
623 pinfo.tunnelhdr = f->tunnelhdr; 624 pinfo.tunnelhdr = f->tunnelhdr;
624 pinfo.pad = 0; 625 pinfo.pad = 0;
625 NLA_PUT(skb, TCA_RSVP_PINFO, sizeof(pinfo), &pinfo); 626 if (nla_put(skb, TCA_RSVP_PINFO, sizeof(pinfo), &pinfo))
626 if (f->res.classid) 627 goto nla_put_failure;
627 NLA_PUT_U32(skb, TCA_RSVP_CLASSID, f->res.classid); 628 if (f->res.classid &&
628 if (((f->handle >> 8) & 0xFF) != 16) 629 nla_put_u32(skb, TCA_RSVP_CLASSID, f->res.classid))
629 NLA_PUT(skb, TCA_RSVP_SRC, sizeof(f->src), f->src); 630 goto nla_put_failure;
631 if (((f->handle >> 8) & 0xFF) != 16 &&
632 nla_put(skb, TCA_RSVP_SRC, sizeof(f->src), f->src))
633 goto nla_put_failure;
630 634
631 if (tcf_exts_dump(skb, &f->exts, &rsvp_ext_map) < 0) 635 if (tcf_exts_dump(skb, &f->exts, &rsvp_ext_map) < 0)
632 goto nla_put_failure; 636 goto nla_put_failure;