aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-03-29 23:15:10 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-01 18:11:37 -0400
commit7f116b5b6c2418e9d9ba2c2ba82cbbad45e36fc5 (patch)
tree05983b2a160db6a7070c55ae5389d583798fd644 /net
parent1b34ec43c9b3de44a5420841ab293d1b2035a94c (diff)
phonet: 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')
-rw-r--r--net/phonet/pn_netlink.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/phonet/pn_netlink.c b/net/phonet/pn_netlink.c
index d61f6761777d..cfdf135fcd69 100644
--- a/net/phonet/pn_netlink.c
+++ b/net/phonet/pn_netlink.c
@@ -116,7 +116,8 @@ static int fill_addr(struct sk_buff *skb, struct net_device *dev, u8 addr,
116 ifm->ifa_flags = IFA_F_PERMANENT; 116 ifm->ifa_flags = IFA_F_PERMANENT;
117 ifm->ifa_scope = RT_SCOPE_LINK; 117 ifm->ifa_scope = RT_SCOPE_LINK;
118 ifm->ifa_index = dev->ifindex; 118 ifm->ifa_index = dev->ifindex;
119 NLA_PUT_U8(skb, IFA_LOCAL, addr); 119 if (nla_put_u8(skb, IFA_LOCAL, addr))
120 goto nla_put_failure;
120 return nlmsg_end(skb, nlh); 121 return nlmsg_end(skb, nlh);
121 122
122nla_put_failure: 123nla_put_failure:
@@ -183,8 +184,9 @@ static int fill_route(struct sk_buff *skb, struct net_device *dev, u8 dst,
183 rtm->rtm_scope = RT_SCOPE_UNIVERSE; 184 rtm->rtm_scope = RT_SCOPE_UNIVERSE;
184 rtm->rtm_type = RTN_UNICAST; 185 rtm->rtm_type = RTN_UNICAST;
185 rtm->rtm_flags = 0; 186 rtm->rtm_flags = 0;
186 NLA_PUT_U8(skb, RTA_DST, dst); 187 if (nla_put_u8(skb, RTA_DST, dst) ||
187 NLA_PUT_U32(skb, RTA_OIF, dev->ifindex); 188 nla_put_u32(skb, RTA_OIF, dev->ifindex))
189 goto nla_put_failure;
188 return nlmsg_end(skb, nlh); 190 return nlmsg_end(skb, nlh);
189 191
190nla_put_failure: 192nla_put_failure: