Commit 61849dda authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parent 2eb812e6
...@@ -166,11 +166,13 @@ static int vlan_fill_info(struct sk_buff *skb, const struct net_device *dev) ...@@ -166,11 +166,13 @@ static int vlan_fill_info(struct sk_buff *skb, const struct net_device *dev)
struct nlattr *nest; struct nlattr *nest;
unsigned int i; unsigned int i;
NLA_PUT_U16(skb, IFLA_VLAN_ID, vlan_dev_priv(dev)->vlan_id); if (nla_put_u16(skb, IFLA_VLAN_ID, vlan_dev_priv(dev)->vlan_id))
goto nla_put_failure;
if (vlan->flags) { if (vlan->flags) {
f.flags = vlan->flags; f.flags = vlan->flags;
f.mask = ~0; f.mask = ~0;
NLA_PUT(skb, IFLA_VLAN_FLAGS, sizeof(f), &f); if (nla_put(skb, IFLA_VLAN_FLAGS, sizeof(f), &f))
goto nla_put_failure;
} }
if (vlan->nr_ingress_mappings) { if (vlan->nr_ingress_mappings) {
nest = nla_nest_start(skb, IFLA_VLAN_INGRESS_QOS); 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,8 +185,9 @@ static int vlan_fill_info(struct sk_buff *skb, const struct net_device *dev)
m.from = i; m.from = i;
m.to = vlan->ingress_priority_map[i]; m.to = vlan->ingress_priority_map[i];
NLA_PUT(skb, IFLA_VLAN_QOS_MAPPING, if (nla_put(skb, IFLA_VLAN_QOS_MAPPING,
sizeof(m), &m); sizeof(m), &m))
goto nla_put_failure;
} }
nla_nest_end(skb, nest); nla_nest_end(skb, nest);
} }
...@@ -202,8 +205,9 @@ static int vlan_fill_info(struct sk_buff *skb, const struct net_device *dev) ...@@ -202,8 +205,9 @@ static int vlan_fill_info(struct sk_buff *skb, const struct net_device *dev)
m.from = pm->priority; m.from = pm->priority;
m.to = (pm->vlan_qos >> 13) & 0x7; m.to = (pm->vlan_qos >> 13) & 0x7;
NLA_PUT(skb, IFLA_VLAN_QOS_MAPPING, if (nla_put(skb, IFLA_VLAN_QOS_MAPPING,
sizeof(m), &m); sizeof(m), &m))
goto nla_put_failure;
} }
} }
nla_nest_end(skb, nest); nla_nest_end(skb, nest);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment