浏览代码

macvlan: 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>
David S. Miller 13 年之前
父节点
当前提交
ead9a76cee
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      drivers/net/macvlan.c

+ 2 - 1
drivers/net/macvlan.c

@@ -773,7 +773,8 @@ static int macvlan_fill_info(struct sk_buff *skb,
 {
 {
 	struct macvlan_dev *vlan = netdev_priv(dev);
 	struct macvlan_dev *vlan = netdev_priv(dev);
 
 
-	NLA_PUT_U32(skb, IFLA_MACVLAN_MODE, vlan->mode);
+	if (nla_put_u32(skb, IFLA_MACVLAN_MODE, vlan->mode))
+		goto nla_put_failure;
 	return 0;
 	return 0;
 
 
 nla_put_failure:
 nla_put_failure: