From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 62F701B74C; Tue, 24 Oct 2017 10:23:14 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Oct 2017 01:23:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,427,1503385200"; d="scan'208";a="1234500645" 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:23:10 -0700 Received: by Sent (sSMTP sendmail emulation); Tue, 24 Oct 2017 10:17:42 +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:17:38 +0200 Message-Id: <1508833058-17189-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-dev] [PATCH v3] net/virtio: fix unchecked return value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 08:23:15 -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