summaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_rules.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-04-01 20:39:02 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-02 04:33:43 -0400
commitf3756b79e8f76cb92830383c215deba146fe0a26 (patch)
tree107c0e99681a0b26b2e750b3fc7a0b01ba1404aa /net/ipv4/fib_rules.c
parente549a6b3a5acff66f0427091e44f814943a26a86 (diff)
downloadlinux-f3756b79e8f76cb92830383c215deba146fe0a26.tar.gz
linux-f3756b79e8f76cb92830383c215deba146fe0a26.tar.bz2
linux-f3756b79e8f76cb92830383c215deba146fe0a26.zip
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/fib_rules.c')
-rw-r--r--net/ipv4/fib_rules.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index 799fc790b3cf..2d043f71ef70 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -221,15 +221,15 @@ static int fib4_rule_fill(struct fib_rule *rule, struct sk_buff *skb,
frh->src_len = rule4->src_len;
frh->tos = rule4->tos;
- if (rule4->dst_len)
- NLA_PUT_BE32(skb, FRA_DST, rule4->dst);
-
- if (rule4->src_len)
- NLA_PUT_BE32(skb, FRA_SRC, rule4->src);
-
+ if ((rule4->dst_len &&
+ nla_put_be32(skb, FRA_DST, rule4->dst)) ||
+ (rule4->src_len &&
+ nla_put_be32(skb, FRA_SRC, rule4->src)))
+ goto nla_put_failure;
#ifdef CONFIG_IP_ROUTE_CLASSID
- if (rule4->tclassid)
- NLA_PUT_U32(skb, FRA_FLOW, rule4->tclassid);
+ if (rule4->tclassid &&
+ nla_put_u32(skb, FRA_FLOW, rule4->tclassid))
+ goto nla_put_failure;
#endif
return 0;