提交 d8fe3436 编写于 作者: R Rajesh Borundia 提交者: David S. Miller

qlcnic: Fix potential NULL dereference

[net-next:master 301/302] drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c:563
 qlcnic_set_multi() error: potential null dereference 'cur'. (kzalloc returns null)

o Break out of the loop after memory allocation failure. Program all the
  MAC addresses that were cached in the return path.
Reported-by: Nkbuild test robot <fengguang.wu@intel.com>
Signed-off-by: NRajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 8466563e
......@@ -560,6 +560,8 @@ void qlcnic_set_multi(struct net_device *netdev)
netdev_for_each_mc_addr(ha, netdev) {
cur = kzalloc(sizeof(struct qlcnic_mac_list_s),
GFP_ATOMIC);
if (cur == NULL)
break;
memcpy(cur->mac_addr,
ha->addr, ETH_ALEN);
list_add_tail(&cur->list, &adapter->vf_mc_list);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册