From f76ef453320c972ebb3aa68cb0f3b989879b1077 Mon Sep 17 00:00:00 2001 From: Sebastian Basierski Date: Tue, 14 Nov 2017 11:39:56 +0100 Subject: [PATCH] net/virtio-user: check error on clearing non block flag 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: stable@dpdk.org Signed-off-by: Sebastian Basierski Acked-by: Jianfeng Tan Acked-by: Maxime Coquelin --- 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 452cdfc88b..2636490063 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -80,7 +80,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; } -- 2.20.1