[dpdk-dev] [PATCH] pmd_virtio: Unchecked return value from library
Basierski, SebastianX
sebastianx.basierski at intel.com
Fri Sep 29 09:44:09 CEST 2017
-----Original Message-----
From: Tan, Jianfeng
Sent: Wednesday, September 20, 2017 2:56 AM
To: Basierski, SebastianX <sebastianx.basierski at intel.com>; skhare at vmware.com
Cc: dev at dpdk.org
Subject: RE: [PATCH] pmd_virtio: Unchecked return value from library
Hi,
Thank you for those fixes.
> -----Original Message-----
> From: Basierski, SebastianX
> Sent: Tuesday, September 19, 2017 7:47 PM
> To: skhare at vmware.com
> Cc: Basierski, SebastianX; Tan, Jianfeng; dev at dpdk.org
> Subject: [PATCH] pmd_virtio: Unchecked return value from library
>
> Check return value from library in order to prevent potential fail.
>
> Coverity issue: 143439
>
> Fixes: ef53b6030039 ("net/virtio-user: support LSC")
> Cc: jianfeng.tan at intel.com
> cc: dev at dpdk.org
>
> Signed-off-by: SebastianX Basierski <sebastianx.basierski at intel.com>
> ---
> drivers/net/virtio/virtio_user_ethdev.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/virtio/virtio_user_ethdev.c
> b/drivers/net/virtio/virtio_user_ethdev.c
> index c961444..16aa350 100644
> --- a/drivers/net/virtio/virtio_user_ethdev.c
> +++ b/drivers/net/virtio/virtio_user_ethdev.c
> @@ -86,7 +86,10 @@ virtio_user_read_dev_config(struct virtio_hw *hw,
> size_t offset,
> int flags;
>
> flags = fcntl(dev->vhostfd, F_GETFL);
> - fcntl(dev->vhostfd, F_SETFL, flags | O_NONBLOCK);
> + if (fcntl(dev->vhostfd, F_SETFL,
> + flags | O_NONBLOCK) == -1)
> + return;
Actually, even it fails, I still prefer to continue instead of "return" here. Maybe, we can report an error message here.
Thanks,
Jianfeng
Hi Jianfeng,
I'like to continue with the task.
So please let me know if You are certain with Your option:
continue instead of return (and add error report), despite possibility of returning error from fcntl.
Regards,
Sebastian Basierski
More information about the dev
mailing list