From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id A8E221B75F; Tue, 24 Oct 2017 10:26:33 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Oct 2017 01:26:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,427,1503385200"; d="scan'208";a="1234501463" Received: from gklab-246-074.igk.intel.com (HELO Sent) ([10.217.246.74]) by fmsmga002.fm.intel.com with SMTP; 24 Oct 2017 01:26:28 -0700 Received: by Sent (sSMTP sendmail emulation); Tue, 24 Oct 2017 10:21:00 +0200 From: SebastianX Basierski To: yliu@fridaylinux.org Cc: dev@dpdk.org, SebastianX Basierski , jianfeng.tan@intel.com, stable@dpdk.org Date: Tue, 24 Oct 2017 10:20:57 +0200 Message-Id: <1508833257-17438-1-git-send-email-sebastianx.basierski@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508821844-37372-2-git-send-email-sebastianx.basierski@intel.com> References: <1508821844-37372-2-git-send-email-sebastianx.basierski@intel.com> Subject: [dpdk-stable] [PATCH v3] net/virtio: fix unchecked return value X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 08:26:34 -0000 Report an error message if the flag O_NONBLOCK setting fails, then return from function. Coverity issue: 143439 Fixes: ef53b6030039 ("net/virtio-user: support LSC") Cc: jianfeng.tan@intel.com cc: stable@dpdk.org Signed-off-by: SebastianX Basierski Acked-by: Jianfeng Tan --- 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 57c964d..20b7292 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -86,7 +86,11 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset, int flags; flags = fcntl(dev->vhostfd, F_GETFL); - fcntl(dev->vhostfd, F_SETFL, flags | O_NONBLOCK); + if (fcntl(dev->vhostfd, F_SETFL, + flags | O_NONBLOCK) == -1) { + PMD_DRV_LOG(ERR, "error setting O_NONBLOCK flag"); + return; + } r = recv(dev->vhostfd, buf, 128, MSG_PEEK); if (r == 0 || (r < 0 && errno != EAGAIN)) { dev->status &= (~VIRTIO_NET_S_LINK_UP); -- 2.7.4