From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id D6A38223 for ; Mon, 13 Nov 2017 16:59:42 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Nov 2017 07:59:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,389,1505804400"; d="scan'208";a="1419873" Received: from junyiwan-mobl.ccr.corp.intel.com (HELO [10.255.24.142]) ([10.255.24.142]) by FMSMGA003.fm.intel.com with ESMTP; 13 Nov 2017 07:59:39 -0800 To: SebastianX Basierski , dev@dpdk.org References: <1510580324-22894-1-git-send-email-sebastianx.basierski@intel.com> Cc: yliu@fridaylinux.org From: "Tan, Jianfeng" Message-ID: <387bd07a-66c7-827a-373b-720382a44677@intel.com> Date: Mon, 13 Nov 2017 23:59:38 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1510580324-22894-1-git-send-email-sebastianx.basierski@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] pmd_virtio: Unchecked return value from library 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: Mon, 13 Nov 2017 15:59:43 -0000 Hi Sebastian, The title can be refined as: net/virtio-user: fix unchecked return value Other than the above comment, it seems good to me. On 11/13/2017 9:38 PM, SebastianX Basierski wrote: > 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 Thank you for the fix. Thanks, Jianfeng > --- > 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; > }