summaryrefslogtreecommitdiff
path: root/drivers/net/virtio/virtio_pci.c
diff options
context:
space:
mode:
authorTiwei Bie <tiwei.bie@intel.com>2018-11-07 17:01:01 +0800
committerFerruh Yigit <ferruh.yigit@intel.com>2018-11-14 00:35:53 +0100
commitecfae1510edc1391285aa566a2d31e7eae8fc6d2 (patch)
tree7a22cd2d21c7aedcb173de460d15ecf4816dde84 /drivers/net/virtio/virtio_pci.c
parentcd1e8f03abf0323e6210ae89a80b89b242a35260 (diff)
downloaddpdk-next-eventdev-ecfae1510edc1391285aa566a2d31e7eae8fc6d2.zip
dpdk-next-eventdev-ecfae1510edc1391285aa566a2d31e7eae8fc6d2.tar.gz
dpdk-next-eventdev-ecfae1510edc1391285aa566a2d31e7eae8fc6d2.tar.xz
net/virtio: fix unchecked return value
Coverity issue: 302861 Fixes: 6ba1f63b5ab0 ("virtio: support specification 1.0") Cc: stable@dpdk.org Signed-off-by: Tiwei Bie <tiwei.bie@intel.com> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Diffstat (limited to 'drivers/net/virtio/virtio_pci.c')
-rw-r--r--drivers/net/virtio/virtio_pci.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 21110cd..c8883c3 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -614,9 +614,15 @@ virtio_read_caps(struct rte_pci_device *dev, struct virtio_hw *hw)
hw->common_cfg = get_cfg_addr(dev, &cap);
break;
case VIRTIO_PCI_CAP_NOTIFY_CFG:
- rte_pci_read_config(dev, &hw->notify_off_multiplier,
+ ret = rte_pci_read_config(dev,
+ &hw->notify_off_multiplier,
4, pos + sizeof(cap));
- hw->notify_base = get_cfg_addr(dev, &cap);
+ if (ret != 4)
+ PMD_INIT_LOG(DEBUG,
+ "failed to read notify_off_multiplier, ret %d",
+ ret);
+ else
+ hw->notify_base = get_cfg_addr(dev, &cap);
break;
case VIRTIO_PCI_CAP_DEVICE_CFG:
hw->dev_cfg = get_cfg_addr(dev, &cap);