From cc7cd517b1a26f284112a5d6e5f40d6c63584930 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 12 Mar 2019 19:12:53 -0700 Subject: [PATCH] net/vdev_netvsc: fix device cast The return value from bus->find_device is a rte_device which is not safe to cast to a rte_vdev_device structure. It doesn't really matter since only being checked for NULL but static checkers might find a bug here. Fixes: 56252de779a6 ("net/vdev_netvsc: add automatic probing") Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger Acked-by: Matan Azrad --- drivers/net/vdev_netvsc/vdev_netvsc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c index ba63fac2a5..801f54c96e 100644 --- a/drivers/net/vdev_netvsc/vdev_netvsc.c +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c @@ -808,7 +808,7 @@ vdev_netvsc_cmp_rte_device(const struct rte_device *dev1, static void vdev_netvsc_scan_callback(__rte_unused void *arg) { - struct rte_vdev_device *dev; + struct rte_device *dev; struct rte_devargs *devargs; struct rte_bus *vbus = rte_bus_find_by_name("vdev"); @@ -816,8 +816,9 @@ vdev_netvsc_scan_callback(__rte_unused void *arg) if (!strncmp(devargs->name, VDEV_NETVSC_DRIVER_NAME, VDEV_NETVSC_DRIVER_NAME_LEN)) return; - dev = (struct rte_vdev_device *)vbus->find_device(NULL, - vdev_netvsc_cmp_rte_device, VDEV_NETVSC_DRIVER_NAME); + + dev = vbus->find_device(NULL, vdev_netvsc_cmp_rte_device, + VDEV_NETVSC_DRIVER_NAME); if (dev) return; if (rte_devargs_add(RTE_DEVTYPE_VIRTUAL, VDEV_NETVSC_DRIVER_NAME)) -- 2.20.1