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 9E4CBDE0 for ; Fri, 29 Sep 2017 09:45:06 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Sep 2017 00:45:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,451,1500966000"; d="scan'208";a="1225107911" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga002.fm.intel.com with ESMTP; 29 Sep 2017 00:44:13 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 29 Sep 2017 00:44:13 -0700 Received: from hasmsx111.ger.corp.intel.com (10.184.198.39) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 29 Sep 2017 00:44:13 -0700 Received: from hasmsx106.ger.corp.intel.com ([169.254.10.144]) by HASMSX111.ger.corp.intel.com ([169.254.5.155]) with mapi id 14.03.0319.002; Fri, 29 Sep 2017 10:44:10 +0300 From: "Basierski, SebastianX" To: "Tan, Jianfeng" , "skhare@vmware.com" CC: "dev@dpdk.org" Thread-Topic: [PATCH] pmd_virtio: Unchecked return value from library Thread-Index: AQHTMT1QpKF8YsDzj0KGnEBhaGBY8qK8wb+AgA7JGBA= Date: Fri, 29 Sep 2017 07:44:09 +0000 Message-ID: <3A7E81AC661B4646A4CE6F2E09B7B74E4BAA2B@HASMSX106.ger.corp.intel.com> References: <1505821646-33594-1-git-send-email-sebastianx.basierski@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.103.103.38] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: Fri, 29 Sep 2017 07:45:07 -0000 -----Original Message----- From: Tan, Jianfeng=20 Sent: Wednesday, September 20, 2017 2:56 AM To: Basierski, SebastianX ; skhare@vmware.c= om Cc: dev@dpdk.org Subject: RE: [PATCH] pmd_virtio: Unchecked return value from library Hi, Thank you for those fixes. > -----Original Message----- > From: Basierski, SebastianX > Sent: Tuesday, September 19, 2017 7:47 PM > To: skhare@vmware.com > Cc: Basierski, SebastianX; Tan, Jianfeng; dev@dpdk.org > Subject: [PATCH] pmd_virtio: Unchecked return value from library >=20 > Check return value from library in order to prevent potential fail. >=20 > Coverity issue: 143439 >=20 > Fixes: ef53b6030039 ("net/virtio-user: support LSC") > Cc: jianfeng.tan@intel.com > cc: dev@dpdk.org >=20 > Signed-off-by: SebastianX Basierski > --- > drivers/net/virtio/virtio_user_ethdev.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/net/virtio/virtio_user_ethdev.c > b/drivers/net/virtio/virtio_user_ethdev.c > index c961444..16aa350 100644 > --- a/drivers/net/virtio/virtio_user_ethdev.c > +++ b/drivers/net/virtio/virtio_user_ethdev.c > @@ -86,7 +86,10 @@ virtio_user_read_dev_config(struct virtio_hw *hw,=20 > size_t offset, > int flags; >=20 > flags =3D fcntl(dev->vhostfd, F_GETFL); > - fcntl(dev->vhostfd, F_SETFL, flags | O_NONBLOCK); > + if (fcntl(dev->vhostfd, F_SETFL, > + flags | O_NONBLOCK) =3D=3D -1) > + return; Actually, even it fails, I still prefer to continue instead of "return" her= e. Maybe, we can report an error message here. Thanks, Jianfeng Hi Jianfeng, I'like to continue with the task. So please let me know if You are certain with Your option: continue instead of return (and add error report), despite possibility of r= eturning error from fcntl. Regards, Sebastian Basierski