All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] examples/flow_classify: fix fseek error handling
@ 2017-11-01 12:10 Bernard Iremonger
  2017-11-03 12:13 ` Singh, Jasvinder
  0 siblings, 1 reply; 3+ messages in thread
From: Bernard Iremonger @ 2017-11-01 12:10 UTC (permalink / raw)
  To: dev, jasvinder.singh; +Cc: Bernard Iremonger

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] examples/flow_classify: fix fseek error handling
  2017-11-01 12:10 [PATCH] examples/flow_classify: fix fseek error handling Bernard Iremonger
@ 2017-11-03 12:13 ` Singh, Jasvinder
  2017-11-07  8:22   ` Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: Singh, Jasvinder @ 2017-11-03 12:13 UTC (permalink / raw)
  To: Iremonger, Bernard, dev



> -----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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] examples/flow_classify: fix fseek error handling
  2017-11-03 12:13 ` Singh, Jasvinder
@ 2017-11-07  8:22   ` Ferruh Yigit
  0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2017-11-07  8:22 UTC (permalink / raw)
  To: Singh, Jasvinder, Iremonger, Bernard, dev

On 11/3/2017 5:13 AM, Singh, Jasvinder wrote:
> 
> 
>> -----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>

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

Applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-07  8:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-01 12:10 [PATCH] examples/flow_classify: fix fseek error handling Bernard Iremonger
2017-11-03 12:13 ` Singh, Jasvinder
2017-11-07  8:22   ` Ferruh Yigit

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.