[PATCH RESEND v2 11/11] bus/vdev: check result of rte_vdev_device_name
    okaya at kernel.org 
    okaya at kernel.org
       
    Tue Nov 22 16:30:53 CET 2022
    
    
  
From: Sinan Kaya <okaya at kernel.org>
In rte_eth_vdev_allocate result of call to rte_vdev_device_name is
dereferenced here and may be null.
Signed-off-by: Sinan Kaya <okaya at kernel.org>
---
 lib/ethdev/ethdev_vdev.h | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/lib/ethdev/ethdev_vdev.h b/lib/ethdev/ethdev_vdev.h
index 364f140f91..6d94a65d97 100644
--- a/lib/ethdev/ethdev_vdev.h
+++ b/lib/ethdev/ethdev_vdev.h
@@ -34,6 +34,8 @@ rte_eth_vdev_allocate(struct rte_vdev_device *dev, size_t private_data_size)
 {
 	struct rte_eth_dev *eth_dev;
 	const char *name = rte_vdev_device_name(dev);
+	if (name == NULL)
+		return NULL;
 
 	eth_dev = rte_eth_dev_allocate(name);
 	if (!eth_dev)
-- 
2.25.1
    
    
More information about the dev
mailing list