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 1FEF1A00E6 for ; Mon, 5 Aug 2019 08:39:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EAC721BE48; Mon, 5 Aug 2019 08:39:08 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id E41171BE47; Mon, 5 Aug 2019 08:39:07 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Aug 2019 23:25:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,348,1559545200"; d="scan'208";a="175497359" Received: from dpdk-xiaoyunl.sh.intel.com ([10.67.110.193]) by fmsmga007.fm.intel.com with ESMTP; 04 Aug 2019 23:25:20 -0700 From: Xiaoyun Li To: jingjing.wu@intel.com Cc: dev@dpdk.org, Xiaoyun Li , stable@dpdk.org Date: Mon, 5 Aug 2019 13:57:28 +0800 Message-Id: <20190805055728.30390-1-xiaoyun.li@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190805050313.28719-1-xiaoyun.li@intel.com> References: <20190805050313.28719-1-xiaoyun.li@intel.com> Subject: [dpdk-dev] [PATCH v2] examples/ntb: fix error handling 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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