diff options
author | David S. Miller <davem@davemloft.net> | 2012-04-01 20:49:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-02 04:33:44 -0400 |
commit | 2eb812e6501597e8b4bc4fdef2db8158c1a3afb6 (patch) | |
tree | e15f5b81094c912b8fb30b3bb68abad070901fdb /net/bridge/br_netlink.c | |
parent | 2809cec5b52b2d02fa0d7dab6e146abfc93c5b86 (diff) |
bridge: 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/bridge/br_netlink.c')
-rw-r--r-- | net/bridge/br_netlink.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index a1daf8227ed1..346b368d8698 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
@@ -60,20 +60,17 @@ static int br_fill_ifinfo(struct sk_buff *skb, const struct net_bridge_port *por | |||
60 | hdr->ifi_flags = dev_get_flags(dev); | 60 | hdr->ifi_flags = dev_get_flags(dev); |
61 | hdr->ifi_change = 0; | 61 | hdr->ifi_change = 0; |
62 | 62 | ||
63 | NLA_PUT_STRING(skb, IFLA_IFNAME, dev->name); | 63 | if (nla_put_string(skb, IFLA_IFNAME, dev->name) || |
64 | NLA_PUT_U32(skb, IFLA_MASTER, br->dev->ifindex); | 64 | nla_put_u32(skb, IFLA_MASTER, br->dev->ifindex) || |
65 | NLA_PUT_U32(skb, IFLA_MTU, dev->mtu); | 65 | nla_put_u32(skb, IFLA_MTU, dev->mtu) || |
66 | NLA_PUT_U8(skb, IFLA_OPERSTATE, operstate); | 66 | nla_put_u8(skb, IFLA_OPERSTATE, operstate) || |
67 | 67 | (dev->addr_len && | |
68 | if (dev->addr_len) | 68 | nla_put(skb, IFLA_ADDRESS, dev->addr_len, dev->dev_addr)) || |
69 | NLA_PUT(skb, IFLA_ADDRESS, dev->addr_len, dev->dev_addr); | 69 | (dev->ifindex != dev->iflink && |
70 | 70 | nla_put_u32(skb, IFLA_LINK, dev->iflink)) || | |
71 | if (dev->ifindex != dev->iflink) | 71 | (event == RTM_NEWLINK && |
72 | NLA_PUT_U32(skb, IFLA_LINK, dev->iflink); | 72 | nla_put_u8(skb, IFLA_PROTINFO, port->state))) |
73 | 73 | goto nla_put_failure; | |
74 | if (event == RTM_NEWLINK) | ||
75 | NLA_PUT_U8(skb, IFLA_PROTINFO, port->state); | ||
76 | |||
77 | return nlmsg_end(skb, nlh); | 74 | return nlmsg_end(skb, nlh); |
78 | 75 | ||
79 | nla_put_failure: | 76 | nla_put_failure: |