ipv6: 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:
David S. Miller
2012-04-01 20:27:33 -04:00
parent 86ebb02dc7
commit c78679e8f3
5 changed files with 53 additions and 46 deletions

View File

@@ -215,14 +215,13 @@ static int fib6_rule_fill(struct fib_rule *rule, struct sk_buff *skb,
frh->src_len = rule6->src.plen;
frh->tos = rule6->tclass;
if (rule6->dst.plen)
NLA_PUT(skb, FRA_DST, sizeof(struct in6_addr),
&rule6->dst.addr);
if (rule6->src.plen)
NLA_PUT(skb, FRA_SRC, sizeof(struct in6_addr),
&rule6->src.addr);
if ((rule6->dst.plen &&
nla_put(skb, FRA_DST, sizeof(struct in6_addr),
&rule6->dst.addr)) ||
(rule6->src.plen &&
nla_put(skb, FRA_SRC, sizeof(struct in6_addr),
&rule6->src.addr)))
goto nla_put_failure;
return 0;
nla_put_failure: