From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 97D10A052B; Wed, 29 Jul 2020 06:23:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B7D9B4C8E; Wed, 29 Jul 2020 06:23:16 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 868E937B7; Wed, 29 Jul 2020 06:23:15 +0200 (CEST) IronPort-SDR: /eLN0RDZVfl2ovXDz6KEiTYt1D2hlfFLeiMORVLdEP/TYqm5y7qoZsGXY7/NybltMc+qSYC4II +gqlHYMA26HA== X-IronPort-AV: E=McAfee;i="6000,8403,9696"; a="151336877" X-IronPort-AV: E=Sophos;i="5.75,408,1589266800"; d="scan'208";a="151336877" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2020 21:23:14 -0700 IronPort-SDR: Am45sWstxg7P4CERd4ZSHuAJtPOCDUh6FwXnFwC8nSGvE2vPi2XDKyiyWwv/PiBxIvSYGjqZyw 1UhIgWB6JcGw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,408,1589266800"; d="scan'208";a="464733085" Received: from npg-dpdk-virtio-xiachenbo-nw.sh.intel.com ([10.67.119.123]) by orsmga005.jf.intel.com with ESMTP; 28 Jul 2020 21:23:12 -0700 From: Chenbo Xia To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, zhihong.wang@intel.com, stable@dpdk.org Date: Wed, 29 Jul 2020 13:12:30 +0000 Message-Id: <20200729131230.14847-1-chenbo.xia@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH v1] net/virtio-user: fix return value check 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Setting the flags of tapfd may fail and the return value should be checked. Coverity issue: 140739 Fixes: e3b434818bbb ("net/virtio-user: support kernel vhost") Cc: stable@dpdk.org Signed-off-by: Chenbo Xia --- drivers/net/virtio/virtio_user/vhost_kernel_tap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c index 2fa4f0d66..acddefa33 100644 --- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c +++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c @@ -128,7 +128,10 @@ vhost_kernel_open_tap(char **p_ifname, int hdr_size, int req_mq, goto error; } - fcntl(tapfd, F_SETFL, O_NONBLOCK); + if (fcntl(tapfd, F_SETFL, O_NONBLOCK) < 0) { + PMD_DRV_LOG(ERR, "fcntl tapfd failed: %s", strerror(errno)); + goto error; + } if (ioctl(tapfd, TUNSETVNETHDRSZ, &hdr_size) < 0) { PMD_DRV_LOG(ERR, "TUNSETVNETHDRSZ failed: %s", strerror(errno)); -- 2.17.1