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

qlcnic: Fix NULL dereference in error path.

o Fix for smatch tool reported error
   drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c:2029
   qlcnic_probe() error: potential NULL dereference 'adapter'.
o While returning from an error path in probe, adapter is not
  initialized. So do not access adapter in cleanup path.
Signed-off-by: NRajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 d8fe3436
......@@ -546,11 +546,10 @@ void qlcnic_teardown_intr(struct qlcnic_adapter *adapter)
}
}
static void
qlcnic_cleanup_pci_map(struct qlcnic_adapter *adapter)
static void qlcnic_cleanup_pci_map(struct qlcnic_hardware_context *ahw)
{
if (adapter->ahw->pci_base0 != NULL)
iounmap(adapter->ahw->pci_base0);
if (ahw->pci_base0 != NULL)
iounmap(ahw->pci_base0);
}
static int qlcnic_get_act_pci_func(struct qlcnic_adapter *adapter)
......@@ -2026,7 +2025,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
free_netdev(netdev);
err_out_iounmap:
qlcnic_cleanup_pci_map(adapter);
qlcnic_cleanup_pci_map(ahw);
err_out_free_hw_res:
kfree(ahw);
......@@ -2083,7 +2082,7 @@ static void qlcnic_remove(struct pci_dev *pdev)
qlcnic_remove_sysfs(adapter);
qlcnic_cleanup_pci_map(adapter);
qlcnic_cleanup_pci_map(adapter->ahw);
qlcnic_release_firmware(adapter);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册