[dpdk-dev] [PATCH] pmd_virtio: Unchecked return value from library
Tan, Jianfeng
jianfeng.tan at intel.com
Wed Sep 20 02:56:15 CEST 2017
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
More information about the dev
mailing list