From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tiwei Bie Subject: [PATCH] vhost: fix potential null pointer dereference Date: Fri, 22 Jun 2018 11:53:05 +0800 Message-ID: <20180622035305.28412-1-tiwei.bie@intel.com> To: maxime.coquelin@redhat.com, zhihong.wang@intel.com, dev@dpdk.org Return-path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id B3D541BADD for ; Fri, 22 Jun 2018 05:53:39 +0200 (CEST) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Coverity issue: 293097 Fixes: d90cf7d111ac ("vhost: support host notifier") Signed-off-by: Tiwei Bie --- lib/librte_vhost/vhost_user.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 26cfebec0..bea6a0428 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); -- 2.17.0