From 3a66890a8ada0a35f9292b1b6ce0326a5c3ce384 Mon Sep 17 00:00:00 2001 From: Bruce Richardson Date: Wed, 1 May 2019 20:50:13 +0100 Subject: [PATCH] raw/skeleton: fix warnings with GCC 9 GCC9 gives warnings if the parameter passed to printf for "%s" could be NULL, so we need to add checks in some cases to ensure that is not the case. Fixes: 61c592a8d035 ("raw/skeleton: introduce skeleton rawdev driver") Cc: stable@dpdk.org Signed-off-by: Bruce Richardson --- drivers/raw/skeleton_rawdev/skeleton_rawdev.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/raw/skeleton_rawdev/skeleton_rawdev.c b/drivers/raw/skeleton_rawdev/skeleton_rawdev.c index d7630fc698..63f2b9a092 100644 --- a/drivers/raw/skeleton_rawdev/skeleton_rawdev.c +++ b/drivers/raw/skeleton_rawdev/skeleton_rawdev.c @@ -705,6 +705,9 @@ skeleton_rawdev_probe(struct rte_vdev_device *vdev) name = rte_vdev_device_name(vdev); + if (name == NULL) + return -EINVAL; + /* More than one instance is not supported */ if (skeldev_init_once) { SKELETON_PMD_ERR("Multiple instance not supported for %s", @@ -740,6 +743,8 @@ skeleton_rawdev_remove(struct rte_vdev_device *vdev) int ret; name = rte_vdev_device_name(vdev); + if (name == NULL) + return -1; SKELETON_PMD_INFO("Closing %s on NUMA node %d", name, rte_socket_id()); -- 2.20.1