[dpdk-dev] [PATCH] pmd_virtio: Unchecked return value from library

Tan, Jianfeng jianfeng.tan at intel.com
Mon Nov 13 16:59:38 CET 2017


Hi Sebastian,

The title can be refined as:

     net/virtio-user: fix unchecked return value

Other than the above comment, it seems good to me.

On 11/13/2017 9:38 PM, SebastianX Basierski wrote:
> Report error message if clearing O_NONBLOCK flag will fail,
> then return from function.
>
> Coverity issue: 143439
>
> Fixes: ef53b6030039 ("net/virtio-user: support LSC")
> Cc: jianfeng.tan at intel.com
> Cc: yliu at fridaylinux.org
> cc: dev at dpdk.org
>
> Signed-off-by: SebastianX Basierski <sebastianx.basierski at intel.com>

Acked-by: Jianfeng Tan <jianfeng.tan at intel.com>

Thank you for the fix.

Thanks,
Jianfeng

> ---
>   drivers/net/virtio/virtio_user_ethdev.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
> index 7be57ce..c1f7a64 100644
> --- a/drivers/net/virtio/virtio_user_ethdev.c
> +++ b/drivers/net/virtio/virtio_user_ethdev.c
> @@ -109,7 +109,11 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset,
>   			} else {
>   				dev->status |= VIRTIO_NET_S_LINK_UP;
>   			}
> -			fcntl(dev->vhostfd, F_SETFL, flags & (~O_NONBLOCK));
> +			if (fcntl(dev->vhostfd, F_SETFL,
> +					flags & ~O_NONBLOCK) == -1) {
> +				PMD_DRV_LOG(ERR, "error clearing O_NONBLOCK flag");
> +				return;
> +			}
>   		}
>   		*(uint16_t *)dst = dev->status;
>   	}



More information about the dev mailing list