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 14ABB23B for ; Wed, 20 Sep 2017 11:17:22 +0200 (CEST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP; 20 Sep 2017 02:17:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,420,1500966000"; d="scan'208";a="153960926" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga006.fm.intel.com with ESMTP; 20 Sep 2017 02:17:19 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 20 Sep 2017 02:17:19 -0700 Received: from hasmsx105.ger.corp.intel.com (10.184.198.19) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 20 Sep 2017 02:17:19 -0700 Received: from hasmsx106.ger.corp.intel.com ([169.254.10.144]) by HASMSX105.ger.corp.intel.com ([169.254.1.195]) with mapi id 14.03.0319.002; Wed, 20 Sep 2017 12:17:16 +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+AgAC5swA= Date: Wed, 20 Sep 2017 09:17:15 +0000 Message-ID: <3A7E81AC661B4646A4CE6F2E09B7B74E4B99D9@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.102.39] Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: Wed, 20 Sep 2017 09:17:23 -0000 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 > = > Check return value from library in order to prevent potential fail. > = > Coverity issue: 143439 > = > Fixes: ef53b6030039 ("net/virtio-user: support LSC") > Cc: jianfeng.tan@intel.com > cc: dev@dpdk.org > = > Signed-off-by: SebastianX Basierski > --- > drivers/net/virtio/virtio_user_ethdev.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > = > 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, = > size_t offset, > int flags; > = > 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, I think, we should at least report an error. Also returning after fcntl failed could save us from operating on corrupted= data. Regards, Sebastian -------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydz= ial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-31= 6 | Kapital zakladowy 200.000 PLN. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata= i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wi= adomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiek= olwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). If you are not the intended recipient= , please contact the sender and delete all copies; any review or distributi= on by others is strictly prohibited.