dect
/
linux-2.6
Archived
13
0
Fork 0

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>
This commit is contained in:
David S. Miller 2012-04-01 20:15:14 -04:00
parent 24c410dce3
commit b21dddb9df
2 changed files with 12 additions and 12 deletions

View File

@ -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_scope = ifa->ifa_scope;
ifm->ifa_index = ifa->ifa_dev->dev->ifindex; ifm->ifa_index = ifa->ifa_dev->dev->ifindex;
if (ifa->ifa_address) if ((ifa->ifa_address &&
NLA_PUT_LE16(skb, IFA_ADDRESS, ifa->ifa_address); nla_put_le16(skb, IFA_ADDRESS, ifa->ifa_address)) ||
if (ifa->ifa_local) (ifa->ifa_local &&
NLA_PUT_LE16(skb, IFA_LOCAL, ifa->ifa_local); nla_put_le16(skb, IFA_LOCAL, ifa->ifa_local)) ||
if (ifa->ifa_label[0]) (ifa->ifa_label[0] &&
NLA_PUT_STRING(skb, IFA_LABEL, ifa->ifa_label); nla_put_string(skb, IFA_LABEL, ifa->ifa_label)))
goto nla_put_failure;
return nlmsg_end(skb, nlh); return nlmsg_end(skb, nlh);
nla_put_failure: nla_put_failure:

View File

@ -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->src_len = r->src_len;
frh->tos = 0; frh->tos = 0;
if (r->dst_len) if ((r->dst_len &&
NLA_PUT_LE16(skb, FRA_DST, r->dst); nla_put_le16(skb, FRA_DST, r->dst)) ||
if (r->src_len) (r->src_len &&
NLA_PUT_LE16(skb, FRA_SRC, r->src); nla_put_le16(skb, FRA_SRC, r->src)))
goto nla_put_failure;
return 0; return 0;
nla_put_failure: nla_put_failure: