vhost: fix potential null pointer dereference

Coverity issue: 293097
Fixes: d90cf7d111ac ("vhost: support host notifier")

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
This commit is contained in:
Tiwei Bie 2018-06-22 11:53:05 +08:00 committed by Ferruh Yigit
parent e11411b52a
commit ad0fdb696a

View File

@ -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);