On 7/29/20 3:12 PM, Chenbo Xia wrote:
> Setting the flags of tapfd may fail and the return value
> should be checked.
> 
> Coverity issue: 140739
> Fixes: e3b434818bbb ("net/virtio-user: support kernel vhost")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Chenbo Xia <chenbo....@intel.com>
> ---
>  drivers/net/virtio/virtio_user/vhost_kernel_tap.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c 
> b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
> index 2fa4f0d66..acddefa33 100644
> --- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
> +++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
> @@ -128,7 +128,10 @@ vhost_kernel_open_tap(char **p_ifname, int hdr_size, int 
> req_mq,
>               goto error;
>       }
>  
> -     fcntl(tapfd, F_SETFL, O_NONBLOCK);
> +     if (fcntl(tapfd, F_SETFL, O_NONBLOCK) < 0) {
> +             PMD_DRV_LOG(ERR, "fcntl tapfd failed: %s", strerror(errno));
> +             goto error;
> +     }
>  
>       if (ioctl(tapfd, TUNSETVNETHDRSZ, &hdr_size) < 0) {
>               PMD_DRV_LOG(ERR, "TUNSETVNETHDRSZ failed: %s", strerror(errno));
> 

Reviewed-by: Maxime Coquelin <maxime.coque...@redhat.com>

Thanks,
Maxime

Reply via email to