examples/vhost_blk: fix unchecked return value
diff mbox series

Message ID 87d9cf9f99c249962a9445167271878896e85d2f.1601032637.git.wangyunjian@huawei.com
State Accepted
Delegated to: Maxime Coquelin
Headers show
Series
  • examples/vhost_blk: fix unchecked return value
Related show

Checks

Context Check Description
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

wangyunjian Sept. 25, 2020, 11:22 a.m. UTC
From: Yunjian Wang <wangyunjian@huawei.com>

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>
---
 examples/vhost_blk/vhost_blk.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Xia, Chenbo Sept. 30, 2020, 5:28 a.m. UTC | #1
> -----Original Message-----
> From: wangyunjian <wangyunjian@huawei.com>
> Sent: Friday, September 25, 2020 7:22 PM
> To: dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>; Wang,
> Zhihong <zhihong.wang@intel.com>; jerry.lilijun@huawei.com;
> xudingke@huawei.com; Yunjian Wang <wangyunjian@huawei.com>;
> stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] examples/vhost_blk: fix unchecked return value
> 
> From: Yunjian Wang <wangyunjian@huawei.com>
> 
> 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>
> ---
>  examples/vhost_blk/vhost_blk.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/vhost_blk/vhost_blk.c
> b/examples/vhost_blk/vhost_blk.c
> index f4c59437a..8f5d61a58 100644
> --- a/examples/vhost_blk/vhost_blk.c
> +++ b/examples/vhost_blk/vhost_blk.c
> @@ -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)
> --
> 2.23.0

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Maxime Coquelin Sept. 30, 2020, 4:18 p.m. UTC | #2
On 9/25/20 1:22 PM, wangyunjian wrote:
> From: Yunjian Wang <wangyunjian@huawei.com>
> 
> 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>
> ---
>  examples/vhost_blk/vhost_blk.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)


Applied to dpdk-next-virtio/main.

Thanks,
Maxime

Patch
diff mbox series

diff --git a/examples/vhost_blk/vhost_blk.c b/examples/vhost_blk/vhost_blk.c
index f4c59437a..8f5d61a58 100644
--- a/examples/vhost_blk/vhost_blk.c
+++ b/examples/vhost_blk/vhost_blk.c
@@ -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)