diff options
author | David S. Miller <davem@davemloft.net> | 2012-04-01 20:15:14 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-02 04:33:42 -0400 |
commit | b21dddb9dfe50ca1e205faf4b25900895494d25b (patch) | |
tree | 3221c2d2673967936e281b1b512ebae2646e4fe2 /net/decnet/dn_rules.c | |
parent | 24c410dce335dba6ad9f1abab833fa4cd32f7f7f (diff) | |
download | op-kernel-dev-b21dddb9dfe50ca1e205faf4b25900895494d25b.zip op-kernel-dev-b21dddb9dfe50ca1e205faf4b25900895494d25b.tar.gz |
decnet: 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/decnet/dn_rules.c')
-rw-r--r-- | net/decnet/dn_rules.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c index f65c9dd..7399e3d 100644 --- a/net/decnet/dn_rules.c +++ b/net/decnet/dn_rules.c @@ -204,11 +204,11 @@ static int dn_fib_rule_fill(struct fib_rule *rule, struct sk_buff *skb, frh->src_len = r->src_len; frh->tos = 0; - if (r->dst_len) - NLA_PUT_LE16(skb, FRA_DST, r->dst); - if (r->src_len) - NLA_PUT_LE16(skb, FRA_SRC, r->src); - + if ((r->dst_len && + nla_put_le16(skb, FRA_DST, r->dst)) || + (r->src_len && + nla_put_le16(skb, FRA_SRC, r->src))) + goto nla_put_failure; return 0; nla_put_failure: |