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 BF81DA00E6 for ; Tue, 6 Aug 2019 09:46:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9E38C1B9D6; Tue, 6 Aug 2019 09:46:10 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 466091B970; Tue, 6 Aug 2019 09:46:07 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Aug 2019 00:46:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,352,1559545200"; d="scan'208";a="164903723" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.117.5]) by orsmga007.jf.intel.com with ESMTP; 06 Aug 2019 00:46:04 -0700 Date: Tue, 6 Aug 2019 15:45:37 +0800 From: Ye Xiaolong To: Xiaoyun Li Cc: jingjing.wu@intel.com, dev@dpdk.org, stable@dpdk.org Message-ID: <20190806074537.GA72009@intel.com> References: <20190805050313.28719-1-xiaoyun.li@intel.com> <20190805055728.30390-1-xiaoyun.li@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190805055728.30390-1-xiaoyun.li@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v2] 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" 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 | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > >diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c >index c169f01a3..f8c970cdb 100644 >--- a/examples/ntb/ntb_fwd.c >+++ b/examples/ntb/ntb_fwd.c >@@ -125,9 +125,15 @@ cmd_sendfile_parsed(void *parsed_result, > return; > } > >- fseek(file, 0, SEEK_END); >+ if (fseek(file, 0, SEEK_END) < 0) { >+ printf("Fail to get file size.\n"); >+ return; >+ } > size = ftell(file); >- fseek(file, 0, SEEK_SET); >+ if (fseek(file, 0, SEEK_SET) < 0) { >+ printf("Fail to get file size.\n"); >+ return; >+ } > > /** > * No FIFO now. Only test memory. Limit sending file >-- >2.17.1 > Reviewed-by: Xiaolong Ye