DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Li, Xiaoyun" <xiaoyun.li@intel.com>
To: "Ye, Xiaolong" <xiaolong.ye@intel.com>
Cc: "Wu, Jingjing" <jingjing.wu@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	"stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] examples/ntb: fix error handling
Date: Mon, 5 Aug 2019 06:19:45 +0000	[thread overview]
Message-ID: <B9E724F4CB7543449049E7AE7669D82F0B2AC14B@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <20190805060447.GG51603@intel.com>

Sure. Will update in v2. Thx.

> -----Original Message-----
> From: Ye, Xiaolong
> Sent: Monday, August 5, 2019 14:05
> To: Li, Xiaoyun <xiaoyun.li@intel.com>
> Cc: Wu, Jingjing <jingjing.wu@intel.com>; dev@dpdk.org; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] examples/ntb: fix error handling
> 
> 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 <xiaoyun.li@intel.com>
> >---
> > 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 = fseek(file, 0, SEEK_END);
> >+	if (status) {
> 
> How about simplify to
> 
> 	if (fseek(file, 0, SEEK_END) < 0)
> 
> >+		printf("Fail to get file size.\n");
> >+		return;
> >+	}
> > 	size = ftell(file);
> >-	fseek(file, 0, SEEK_SET);
> >+	status = fseek(file, 0, SEEK_SET);
> >+	if (status) {
> 
> Ditto.
> 
> Thanks,
> Xiaolong
> >+		printf("Fail to get file size.\n");
> >+		return;
> >+	}
> >
> > 	/**
> > 	 * No FIFO now. Only test memory. Limit sending file
> >--
> >2.17.1
> >

      reply	other threads:[~2019-08-05  6:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-05  5:03 Xiaoyun Li
2019-08-05  5:57 ` [dpdk-dev] [PATCH v2] " Xiaoyun Li
2019-08-06  7:45   ` Ye Xiaolong
2019-08-06  8:33     ` Thomas Monjalon
2019-08-05  6:04 ` [dpdk-dev] [PATCH] " Ye Xiaolong
2019-08-05  6:19   ` Li, Xiaoyun [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B9E724F4CB7543449049E7AE7669D82F0B2AC14B@SHSMSX101.ccr.corp.intel.com \
    --to=xiaoyun.li@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=stable@dpdk.org \
    --cc=xiaolong.ye@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).