[dpdk-dev] [PATCH 1/1] librte_ether: fix coverity errors in rte_eth_copy_pci_info
Thomas Monjalon
thomas.monjalon at 6wind.com
Fri Nov 6 17:39:43 CET 2015
2015-11-06 16:30, Bernard Iremonger:
> add else branch to if statement.
I think a return statement would be more appropriate.
> Dereferencing NULL pointer reported by Coverity, CID 119256.
> Dereferencing NULL pointer reported by Coverity, CID 119257.
>
> Signed-off-by: Bernard Iremonger <bernard.iremonger at intel.com>
[...]
> if ((eth_dev == NULL) || (pci_dev == NULL)) {
> PMD_DEBUG_TRACE("NULL pointer eth_dev=%p pci_dev=%p\n",
> eth_dev, pci_dev);
> - }
> -
> - eth_dev->data->dev_flags = 0;
> - if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC)
> - eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC;
> - if (pci_dev->driver->drv_flags & RTE_PCI_DRV_DETACHABLE)
> - eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
> + } else {
> + eth_dev->data->dev_flags = 0;
> + if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC)
> + eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC;
> + if (pci_dev->driver->drv_flags & RTE_PCI_DRV_DETACHABLE)
> + eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
More information about the dev
mailing list