DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Singh, Jasvinder" <jasvinder.singh@intel.com>
To: "Iremonger, Bernard" <bernard.iremonger@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] examples/flow_classify: fix fseek error handling
Date: Fri, 3 Nov 2017 12:13:48 +0000	[thread overview]
Message-ID: <54CBAA185211B4429112C315DA58FF6D332802B7@IRSMSX103.ger.corp.intel.com> (raw)
In-Reply-To: <1509538229-1354-1-git-send-email-bernard.iremonger@intel.com>



> -----Original Message-----
> From: Iremonger, Bernard
> Sent: Wednesday, November 1, 2017 12:10 PM
> To: dev@dpdk.org; Singh, Jasvinder <jasvinder.singh@intel.com>
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>
> Subject: [PATCH] examples/flow_classify: fix fseek error handling
> 
> Check return value of fseek and exit if non zero.
> 
> Coverity issue: 143435
> 
> Fixes: bab16ddaf2c1 ("examples/flow_classify: add sample application")
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> ---
>  examples/flow_classify/flow_classify.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/examples/flow_classify/flow_classify.c
> b/examples/flow_classify/flow_classify.c
> index e4cabdb..766f1dd 100644
> --- a/examples/flow_classify/flow_classify.c
> +++ b/examples/flow_classify/flow_classify.c
> @@ -657,13 +657,17 @@ static __attribute__((noreturn)) void
>  	unsigned int i = 0;
>  	unsigned int total_num = 0;
>  	struct rte_eth_ntuple_filter ntuple_filter;
> +	int ret;
> 
>  	fh = fopen(rule_path, "rb");
>  	if (fh == NULL)
> -		rte_exit(EXIT_FAILURE, "%s: Open %s failed\n", __func__,
> +		rte_exit(EXIT_FAILURE, "%s: fopen %s failed\n", __func__,
>  			rule_path);
> 
> -	fseek(fh, 0, SEEK_SET);
> +	ret = fseek(fh, 0, SEEK_SET);
> +	if (ret)
> +		rte_exit(EXIT_FAILURE, "%s: fseek %d failed\n", __func__,
> +			ret);
> 
>  	i = 0;
>  	while (fgets(buff, LINE_MAX, fh) != NULL) {
> --
> 1.9.1

Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>

  reply	other threads:[~2017-11-03 12:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-01 12:10 Bernard Iremonger
2017-11-03 12:13 ` Singh, Jasvinder [this message]
2017-11-07  8:22   ` Ferruh Yigit

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=54CBAA185211B4429112C315DA58FF6D332802B7@IRSMSX103.ger.corp.intel.com \
    --to=jasvinder.singh@intel.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    /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).