On Mon, Dec 16, 2019 at 09:03:15AM +0800, Yunjian Wang wrote:
> The function vhost_kernel_tap_set_offload() could return errors,
> the return value need to be checked.
> 
> Fixes: 1db4d2330bc8 ("net/virtio-user: check negotiated features before set")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Yunjian Wang <wangyunj...@huawei.com>
> ---
>  drivers/net/virtio/virtio_user/vhost_kernel_tap.c | 3 ++-
>  1 file changed, 2 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 76bf754..f77d227 100644
> --- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
> +++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
> @@ -131,7 +131,8 @@
>               goto error;
>       }
>  
> -     vhost_kernel_tap_set_offload(tapfd, features);
> +     if (vhost_kernel_tap_set_offload(tapfd, features) < 0)
> +             goto error;

It's not necessary to fail in this case. At least, there
is no need to fail when error is -ENOTSUP.

>  
>       memset(&ifr, 0, sizeof(ifr));
>       ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER;
> -- 
> 1.8.3.1
> 
> 

Reply via email to