diff options
author | David S. Miller <davem@davemloft.net> | 2012-04-01 20:50:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-02 04:33:44 -0400 |
commit | 61849dda1dd4ee286521fdfde388dcfc1d891bad (patch) | |
tree | 874e485edd5d095ed75618b45dc8042f86618ffa /net/8021q | |
parent | 2eb812e6501597e8b4bc4fdef2db8158c1a3afb6 (diff) |
vlan: 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/8021q')
-rw-r--r-- | net/8021q/vlan_netlink.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c index 50711368ad6a..708c80ea1874 100644 --- a/net/8021q/vlan_netlink.c +++ b/net/8021q/vlan_netlink.c | |||
@@ -166,11 +166,13 @@ static int vlan_fill_info(struct sk_buff *skb, const struct net_device *dev) | |||
166 | struct nlattr *nest; | 166 | struct nlattr *nest; |
167 | unsigned int i; | 167 | unsigned int i; |
168 | 168 | ||
169 | NLA_PUT_U16(skb, IFLA_VLAN_ID, vlan_dev_priv(dev)->vlan_id); | 169 | if (nla_put_u16(skb, IFLA_VLAN_ID, vlan_dev_priv(dev)->vlan_id)) |
170 | goto nla_put_failure; | ||
170 | if (vlan->flags) { | 171 | if (vlan->flags) { |
171 | f.flags = vlan->flags; | 172 | f.flags = vlan->flags; |
172 | f.mask = ~0; | 173 | f.mask = ~0; |
173 | NLA_PUT(skb, IFLA_VLAN_FLAGS, sizeof(f), &f); | 174 | if (nla_put(skb, IFLA_VLAN_FLAGS, sizeof(f), &f)) |
175 | goto nla_put_failure; | ||
174 | } | 176 | } |
175 | if (vlan->nr_ingress_mappings) { | 177 | if (vlan->nr_ingress_mappings) { |
176 | nest = nla_nest_start(skb, IFLA_VLAN_INGRESS_QOS); | 178 | nest = nla_nest_start(skb, IFLA_VLAN_INGRESS_QOS); |
@@ -183,8 +185,9 @@ static int vlan_fill_info(struct sk_buff *skb, const struct net_device *dev) | |||
183 | 185 | ||
184 | m.from = i; | 186 | m.from = i; |
185 | m.to = vlan->ingress_priority_map[i]; | 187 | m.to = vlan->ingress_priority_map[i]; |
186 | NLA_PUT(skb, IFLA_VLAN_QOS_MAPPING, | 188 | if (nla_put(skb, IFLA_VLAN_QOS_MAPPING, |
187 | sizeof(m), &m); | 189 | sizeof(m), &m)) |
190 | goto nla_put_failure; | ||
188 | } | 191 | } |
189 | nla_nest_end(skb, nest); | 192 | nla_nest_end(skb, nest); |
190 | } | 193 | } |
@@ -202,8 +205,9 @@ static int vlan_fill_info(struct sk_buff *skb, const struct net_device *dev) | |||
202 | 205 | ||
203 | m.from = pm->priority; | 206 | m.from = pm->priority; |
204 | m.to = (pm->vlan_qos >> 13) & 0x7; | 207 | m.to = (pm->vlan_qos >> 13) & 0x7; |
205 | NLA_PUT(skb, IFLA_VLAN_QOS_MAPPING, | 208 | if (nla_put(skb, IFLA_VLAN_QOS_MAPPING, |
206 | sizeof(m), &m); | 209 | sizeof(m), &m)) |
210 | goto nla_put_failure; | ||
207 | } | 211 | } |
208 | } | 212 | } |
209 | nla_nest_end(skb, nest); | 213 | nla_nest_end(skb, nest); |