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 54984A00E6 for ; Mon, 5 Aug 2019 08:33:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 308FC1BE58; Mon, 5 Aug 2019 08:33:09 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 972401BE36; Mon, 5 Aug 2019 08:33:05 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Aug 2019 23:19:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,348,1559545200"; d="scan'208";a="197866495" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga004.fm.intel.com with ESMTP; 04 Aug 2019 23:19:47 -0700 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 4 Aug 2019 23:19:47 -0700 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by fmsmsx123.amr.corp.intel.com (10.18.125.38) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 4 Aug 2019 23:19:47 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.80]) by SHSMSX154.ccr.corp.intel.com ([169.254.7.249]) with mapi id 14.03.0439.000; Mon, 5 Aug 2019 14:19:45 +0800 From: "Li, Xiaoyun" To: "Ye, Xiaolong" CC: "Wu, Jingjing" , "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] examples/ntb: fix error handling Thread-Index: AQHVS077L1B9rXp3X027d62+CNB/labriqSAgACKMWA= Date: Mon, 5 Aug 2019 06:19:45 +0000 Message-ID: References: <20190805050313.28719-1-xiaoyun.li@intel.com> <20190805060447.GG51603@intel.com> In-Reply-To: <20190805060447.GG51603@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] examples/ntb: fix error handling X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Sure. Will update in v2. Thx. > -----Original Message----- > From: Ye, Xiaolong > Sent: Monday, August 5, 2019 14:05 > To: Li, Xiaoyun > Cc: Wu, Jingjing ; dev@dpdk.org; stable@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] examples/ntb: fix error handling >=20 > On 08/05, Xiaoyun Li wrote: > >This patch adds return value checking for fseek function to fix error > >handling issue found by coverity scan. > > > >Coverity issue: 344996 > >Fixes: c5eebf85badc ("examples/ntb: add example for NTB") > >Cc: stable@dpdk.org > > > >Signed-off-by: Xiaoyun Li > >--- > > examples/ntb/ntb_fwd.c | 13 +++++++++++-- > > 1 file changed, 11 insertions(+), 2 deletions(-) > > > >diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c index > >c169f01a3..671b13f50 100644 > >--- a/examples/ntb/ntb_fwd.c > >+++ b/examples/ntb/ntb_fwd.c > >@@ -107,6 +107,7 @@ cmd_sendfile_parsed(void *parsed_result, > > uint8_t *buff; > > uint32_t val; > > FILE *file; > >+ int status; > > > > if (!rte_rawdevs[dev_id].started) { > > printf("Device needs to be up first. Try later.\n"); @@ -125,9 > >+126,17 @@ cmd_sendfile_parsed(void *parsed_result, > > return; > > } > > > >- fseek(file, 0, SEEK_END); > >+ status =3D fseek(file, 0, SEEK_END); > >+ if (status) { >=20 > How about simplify to >=20 > if (fseek(file, 0, SEEK_END) < 0) >=20 > >+ printf("Fail to get file size.\n"); > >+ return; > >+ } > > size =3D ftell(file); > >- fseek(file, 0, SEEK_SET); > >+ status =3D fseek(file, 0, SEEK_SET); > >+ if (status) { >=20 > Ditto. >=20 > Thanks, > Xiaolong > >+ printf("Fail to get file size.\n"); > >+ return; > >+ } > > > > /** > > * No FIFO now. Only test memory. Limit sending file > >-- > >2.17.1 > >