Commit ad9bf545 authored by Colin Ian King's avatar Colin Ian King Committed by David S. Miller

net: hns3: fix dereference of ae_dev before it is null checked

Pointer ae_dev is null checked however, prior to that it is dereferenced
when assigned pointer ops. Fix this by assigning pointer ops after ae_dev
has been null checked.

Addresses-Coverity: ("Dereference before null check")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 43321251
......@@ -1940,13 +1940,14 @@ static pci_ers_result_t hns3_error_detected(struct pci_dev *pdev,
static pci_ers_result_t hns3_slot_reset(struct pci_dev *pdev)
{
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(pdev);
const struct hnae3_ae_ops *ops = ae_dev->ops;
const struct hnae3_ae_ops *ops;
enum hnae3_reset_type reset_type;
struct device *dev = &pdev->dev;
if (!ae_dev || !ae_dev->ops)
return PCI_ERS_RESULT_NONE;
ops = ae_dev->ops;
/* request the reset */
if (ops->reset_event) {
if (!ae_dev->override_pci_need_reset) {
......
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