aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/devinet.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/devinet.c
parente549a6b3a5acff66f0427091e44f814943a26a86 (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/devinet.c')
-rw-r--r--net/ipv4/devinet.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index d4fad5c77447..3ffaad0ef98f 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1267,17 +1267,15 @@ static int inet_fill_ifaddr(struct sk_buff *skb, struct in_ifaddr *ifa,
1267 ifm->ifa_scope = ifa->ifa_scope; 1267 ifm->ifa_scope = ifa->ifa_scope;
1268 ifm->ifa_index = ifa->ifa_dev->dev->ifindex; 1268 ifm->ifa_index = ifa->ifa_dev->dev->ifindex;
1269 1269
1270 if (ifa->ifa_address) 1270 if ((ifa->ifa_address &&
1271 NLA_PUT_BE32(skb, IFA_ADDRESS, ifa->ifa_address); 1271 nla_put_be32(skb, IFA_ADDRESS, ifa->ifa_address)) ||
1272 1272 (ifa->ifa_local &&
1273 if (ifa->ifa_local) 1273 nla_put_be32(skb, IFA_LOCAL, ifa->ifa_local)) ||
1274 NLA_PUT_BE32(skb, IFA_LOCAL, ifa->ifa_local); 1274 (ifa->ifa_broadcast &&
1275 1275 nla_put_be32(skb, IFA_BROADCAST, ifa->ifa_broadcast)) ||
1276 if (ifa->ifa_broadcast) 1276 (ifa->ifa_label[0] &&
1277 NLA_PUT_BE32(skb, IFA_BROADCAST, ifa->ifa_broadcast); 1277 nla_put_string(skb, IFA_LABEL, ifa->ifa_label)))
1278 1278 goto nla_put_failure;
1279 if (ifa->ifa_label[0])
1280 NLA_PUT_STRING(skb, IFA_LABEL, ifa->ifa_label);
1281 1279
1282 return nlmsg_end(skb, nlh); 1280 return nlmsg_end(skb, nlh);
1283 1281