[dpdk-dev] [PATCH 13/14] lib/ether: check magic in rte_eth_copy_pci_info

Jan Viktorin viktorin at rehivetech.com
Mon Jan 4 21:08:25 CET 2016


Signed-off-by: Jan Viktorin <viktorin at rehivetech.com>
---
 lib/librte_ether/rte_ethdev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 6fb3423..75121bc 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3293,6 +3293,12 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_de
 		return;
 	}
 
+	if (eth_dev->dev->magic != RTE_PCI_DEVICE_MAGIC) {
+		rte_panic("%s() unexpected device magic: %08x\n",
+				__func__, eth_dev->dev->magic);
+		return;
+	}
+
 	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;
-- 
2.6.3



More information about the dev mailing list