aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-04-01 20:15:14 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-02 04:33:42 -0400
commitb21dddb9dfe50ca1e205faf4b25900895494d25b (patch)
tree3221c2d2673967936e281b1b512ebae2646e4fe2
parent24c410dce335dba6ad9f1abab833fa4cd32f7f7f (diff)
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>
-rw-r--r--net/decnet/dn_dev.c14
-rw-r--r--net/decnet/dn_rules.c10
2 files changed, 12 insertions, 12 deletions
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 74d321a60e7b..16efcda2f060 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -695,13 +695,13 @@ static int dn_nl_fill_ifaddr(struct sk_buff *skb, struct dn_ifaddr *ifa,
695 ifm->ifa_scope = ifa->ifa_scope; 695 ifm->ifa_scope = ifa->ifa_scope;
696 ifm->ifa_index = ifa->ifa_dev->dev->ifindex; 696 ifm->ifa_index = ifa->ifa_dev->dev->ifindex;
697 697
698 if (ifa->ifa_address) 698 if ((ifa->ifa_address &&
699 NLA_PUT_LE16(skb, IFA_ADDRESS, ifa->ifa_address); 699 nla_put_le16(skb, IFA_ADDRESS, ifa->ifa_address)) ||
700 if (ifa->ifa_local) 700 (ifa->ifa_local &&
701 NLA_PUT_LE16(skb, IFA_LOCAL, ifa->ifa_local); 701 nla_put_le16(skb, IFA_LOCAL, ifa->ifa_local)) ||
702 if (ifa->ifa_label[0]) 702 (ifa->ifa_label[0] &&
703 NLA_PUT_STRING(skb, IFA_LABEL, ifa->ifa_label); 703 nla_put_string(skb, IFA_LABEL, ifa->ifa_label)))
704 704 goto nla_put_failure;
705 return nlmsg_end(skb, nlh); 705 return nlmsg_end(skb, nlh);
706 706
707nla_put_failure: 707nla_put_failure:
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c
index f65c9ddaee41..7399e3d51922 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,
204 frh->src_len = r->src_len; 204 frh->src_len = r->src_len;
205 frh->tos = 0; 205 frh->tos = 0;
206 206
207 if (r->dst_len) 207 if ((r->dst_len &&
208 NLA_PUT_LE16(skb, FRA_DST, r->dst); 208 nla_put_le16(skb, FRA_DST, r->dst)) ||
209 if (r->src_len) 209 (r->src_len &&
210 NLA_PUT_LE16(skb, FRA_SRC, r->src); 210 nla_put_le16(skb, FRA_SRC, r->src)))
211 211 goto nla_put_failure;
212 return 0; 212 return 0;
213 213
214nla_put_failure: 214nla_put_failure: