examples/vhost_blk: check driver start failure
authorYunjian Wang <wangyunjian@huawei.com>
Fri, 25 Sep 2020 11:22:06 +0000 (19:22 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 30 Sep 2020 21:16:55 +0000 (23:16 +0200)
This checks the return value from the function
rte_vhost_driver_start.

Coverity issue: 362027
Fixes: c19beb3f38cd ("examples/vhost_blk: introduce vhost storage sample")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
examples/vhost_blk/vhost_blk.c

index f4c5943..8f5d61a 100644 (file)
@@ -877,7 +877,11 @@ int main(int argc, char *argv[])
 
        signal(SIGINT, signal_handler);
 
-       rte_vhost_driver_start(dev_pathname);
+       ret = rte_vhost_driver_start(dev_pathname);
+       if (ret < 0) {
+               fprintf(stderr, "Failed to start vhost driver.\n");
+               return -1;
+       }
 
        /* loop for exit the application */
        while (1)