[dpdk-dev] [PATCH v2] net/virtio-user: fix unchecked return value

Maxime Coquelin maxime.coquelin at redhat.com
Tue Nov 14 10:43:53 CET 2017


Hi Sebastian,

On 11/14/2017 10:27 AM, SebastianX Basierski wrote:
> Report error message if clearing O_NONBLOCK flag will fail,
> then return from function.
> 
> ---
> v2:
> 	Patch title changed.
> ---

^^^^The above note should be placed just before diffstats to be removed
at apply time.

> 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>
> ---

Here

>   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;
>   	}
> 

Other than that:
Acked-by: Maxime Coquelin <maxime.coquelin at redhat.com>

Thanks,
Maxime


More information about the dev mailing list