From: Tiwei Bie Date: Fri, 22 Jun 2018 03:53:05 +0000 (+0800) Subject: vhost: fix potential null pointer dereference X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=ad0fdb696a96311629e14f43db39250a92f02e7d;p=dpdk.git vhost: fix potential null pointer dereference Coverity issue: 293097 Fixes: d90cf7d111ac ("vhost: support host notifier") Signed-off-by: Tiwei Bie Reviewed-by: Maxime Coquelin --- diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 26cfebec07..bea6a0428a 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -1830,6 +1830,8 @@ int vhost_user_host_notifier_ctrl(int vid, bool enable) return -ENOTSUP; vdpa_dev = rte_vdpa_get_device(did); + if (!vdpa_dev) + return -ENODEV; RTE_FUNC_PTR_OR_ERR_RET(vdpa_dev->ops->get_vfio_device_fd, -ENOTSUP); RTE_FUNC_PTR_OR_ERR_RET(vdpa_dev->ops->get_notify_area, -ENOTSUP);