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_dev.c | |
parent | 24c410dce335dba6ad9f1abab833fa4cd32f7f7f (diff) | |
download | linux-b21dddb9dfe50ca1e205faf4b25900895494d25b.tar.bz2 |
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_dev.c')
-rw-r--r-- | net/decnet/dn_dev.c | 14 |
1 files changed, 7 insertions, 7 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, ifm->ifa_scope = ifa->ifa_scope; ifm->ifa_index = ifa->ifa_dev->dev->ifindex; - if (ifa->ifa_address) - NLA_PUT_LE16(skb, IFA_ADDRESS, ifa->ifa_address); - if (ifa->ifa_local) - NLA_PUT_LE16(skb, IFA_LOCAL, ifa->ifa_local); - if (ifa->ifa_label[0]) - NLA_PUT_STRING(skb, IFA_LABEL, ifa->ifa_label); - + if ((ifa->ifa_address && + nla_put_le16(skb, IFA_ADDRESS, ifa->ifa_address)) || + (ifa->ifa_local && + nla_put_le16(skb, IFA_LOCAL, ifa->ifa_local)) || + (ifa->ifa_label[0] && + nla_put_string(skb, IFA_LABEL, ifa->ifa_label))) + goto nla_put_failure; return nlmsg_end(skb, nlh); nla_put_failure: |