From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 4B3E31B32A for ; Tue, 14 Nov 2017 10:32:04 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Nov 2017 01:32:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,393,1505804400"; d="scan'208";a="2426461" Received: from gklab-246-074.igk.intel.com (HELO Sent) ([10.217.246.74]) by fmsmga001.fm.intel.com with SMTP; 14 Nov 2017 01:32:00 -0800 Received: by Sent (sSMTP sendmail emulation); Tue, 14 Nov 2017 10:27:37 +0100 From: SebastianX Basierski To: dev@dpdk.org Cc: SebastianX Basierski , jianfeng.tan@intel.com, yliu@fridaylinux.org Date: Tue, 14 Nov 2017 10:27:35 +0100 Message-Id: <1510651655-36160-1-git-send-email-sebastianx.basierski@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510580324-22894-1-git-send-email-sebastianx.basierski@intel.com> References: <1510580324-22894-1-git-send-email-sebastianx.basierski@intel.com> Subject: [dpdk-dev] [PATCH v2] 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 09:32:05 -0000 Report error message if clearing O_NONBLOCK flag will fail, then return from function. --- v2: Patch title changed. --- 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 --- 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