From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 0CFFF160 for ; Tue, 14 Nov 2017 11:42:14 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Nov 2017 02:42:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,393,1505804400"; d="scan'208";a="7432075" Received: from gklab-246-074.igk.intel.com (HELO Sent) ([10.217.246.74]) by orsmga002.jf.intel.com with SMTP; 14 Nov 2017 02:42:11 -0800 Received: by Sent (sSMTP sendmail emulation); Tue, 14 Nov 2017 11:39:57 +0100 From: SebastianX Basierski To: dev@dpdk.org Cc: SebastianX Basierski , jianfeng.tan@intel.com, yliu@fridaylinux.org Date: Tue, 14 Nov 2017 11:39:56 +0100 Message-Id: <1510655996-39288-1-git-send-email-sebastianx.basierski@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510651655-36160-1-git-send-email-sebastianx.basierski@intel.com> References: <1510651655-36160-1-git-send-email-sebastianx.basierski@intel.com> Subject: [dpdk-dev] [PATCH v3] net/virtio-user: 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, 14 Nov 2017 10:42:15 -0000 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@intel.com Cc: yliu@fridaylinux.org cc: dev@dpdk.org Signed-off-by: SebastianX Basierski Acked-by: Jianfeng Tan Acked-by: Maxime Coquelin --- v2: Patch title changed. --- 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; } -- 2.7.4