Skip to content

Commit

Permalink
net/hns3: check PCI config space write
Browse files Browse the repository at this point in the history
[ upstream commit 6dd32de ]

Here adds a check for the return value when calling
rte_pci_write_config.

Coverity issue: 363714
Fixes: cea37e5 ("net/hns3: fix FLR reset")

Signed-off-by: Lijun Ou <oulijun@huawei.com>
  • Loading branch information
oulijun authored and bluca committed Nov 16, 2020
1 parent 18b6f15 commit 99ce983
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/net/hns3/hns3_ethdev_vf.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,12 @@ hns3vf_enable_msix(const struct rte_pci_device *device, bool op)
control |= PCI_MSIX_FLAGS_ENABLE;
else
control &= ~PCI_MSIX_FLAGS_ENABLE;
rte_pci_write_config(device, &control, sizeof(control),
(pos + PCI_MSIX_FLAGS));
ret = rte_pci_write_config(device, &control, sizeof(control),
(pos + PCI_MSIX_FLAGS));
if (ret < 0) {
PMD_INIT_LOG(ERR, "failed to write PCI offset 0x%x",
(pos + PCI_MSIX_FLAGS));
}
return 0;
}
return -1;
Expand Down

0 comments on commit 99ce983

Please sign in to comment.