diff options
author | David S. Miller <davem@davemloft.net> | 2012-04-01 20:39:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-02 04:33:43 -0400 |
commit | f3756b79e8f76cb92830383c215deba146fe0a26 (patch) | |
tree | 107c0e99681a0b26b2e750b3fc7a0b01ba1404aa /net/ipv4/ip_gre.c | |
parent | e549a6b3a5acff66f0427091e44f814943a26a86 (diff) |
ipv4: 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/ipv4/ip_gre.c')
-rw-r--r-- | net/ipv4/ip_gre.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index b57532d4742c..02d07c6f630f 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -1654,17 +1654,18 @@ static int ipgre_fill_info(struct sk_buff *skb, const struct net_device *dev) | |||
1654 | struct ip_tunnel *t = netdev_priv(dev); | 1654 | struct ip_tunnel *t = netdev_priv(dev); |
1655 | struct ip_tunnel_parm *p = &t->parms; | 1655 | struct ip_tunnel_parm *p = &t->parms; |
1656 | 1656 | ||
1657 | NLA_PUT_U32(skb, IFLA_GRE_LINK, p->link); | 1657 | if (nla_put_u32(skb, IFLA_GRE_LINK, p->link) || |
1658 | NLA_PUT_BE16(skb, IFLA_GRE_IFLAGS, p->i_flags); | 1658 | nla_put_be16(skb, IFLA_GRE_IFLAGS, p->i_flags) || |
1659 | NLA_PUT_BE16(skb, IFLA_GRE_OFLAGS, p->o_flags); | 1659 | nla_put_be16(skb, IFLA_GRE_OFLAGS, p->o_flags) || |
1660 | NLA_PUT_BE32(skb, IFLA_GRE_IKEY, p->i_key); | 1660 | nla_put_be32(skb, IFLA_GRE_IKEY, p->i_key) || |
1661 | NLA_PUT_BE32(skb, IFLA_GRE_OKEY, p->o_key); | 1661 | nla_put_be32(skb, IFLA_GRE_OKEY, p->o_key) || |
1662 | NLA_PUT_BE32(skb, IFLA_GRE_LOCAL, p->iph.saddr); | 1662 | nla_put_be32(skb, IFLA_GRE_LOCAL, p->iph.saddr) || |
1663 | NLA_PUT_BE32(skb, IFLA_GRE_REMOTE, p->iph.daddr); | 1663 | nla_put_be32(skb, IFLA_GRE_REMOTE, p->iph.daddr) || |
1664 | NLA_PUT_U8(skb, IFLA_GRE_TTL, p->iph.ttl); | 1664 | nla_put_u8(skb, IFLA_GRE_TTL, p->iph.ttl) || |
1665 | NLA_PUT_U8(skb, IFLA_GRE_TOS, p->iph.tos); | 1665 | nla_put_u8(skb, IFLA_GRE_TOS, p->iph.tos) || |
1666 | NLA_PUT_U8(skb, IFLA_GRE_PMTUDISC, !!(p->iph.frag_off & htons(IP_DF))); | 1666 | nla_put_u8(skb, IFLA_GRE_PMTUDISC, |
1667 | 1667 | !!(p->iph.frag_off & htons(IP_DF)))) | |
1668 | goto nla_put_failure; | ||
1668 | return 0; | 1669 | return 0; |
1669 | 1670 | ||
1670 | nla_put_failure: | 1671 | nla_put_failure: |