[v2] examples/ipsec-secgw: fix negative argument passing

Message ID 20200506103752.20478-1-praveen.shetty@intel.com (mailing list archive)
State Superseded, archived
Delegated to: akhil goyal
Headers
Series [v2] examples/ipsec-secgw: fix negative argument passing |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK

Commit Message

Shetty, Praveen May 6, 2020, 10:37 a.m. UTC
  Function create_ipsec_esp_flow returns a negative number in case of any
failure and we are passing this to strerror to dsiplay the error message.
But strerror()'s argument cannot be negative.
In case of failure, displaying exact error message to console is handled
in create_ipsec_esp_flow function.So it is not required to print the
error message again using strerror.
This patch will remove the unnecessary calling of strerror function
to fix the negative argument passing to strerror issue.

Coverity issue: 357691
Fixes: 6738c0a95695 ("examples/ipsec-secgw: support flow director")
Cc: praveen.shetty@intel.com

Signed-off-by: Praveen Shetty <praveen.shetty@intel.com>
Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
---
v2 changes:
changed commit headline and rephrased commit message.

 examples/ipsec-secgw/sa.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Lukasz Wojciechowski May 6, 2020, 10:50 a.m. UTC | #1
W dniu 06.05.2020 o 12:37, Praveen Shetty pisze:
> Function create_ipsec_esp_flow returns a negative number in case of any
> failure and we are passing this to strerror to dsiplay the error message.
typo dsiplay -> display
> But strerror()'s argument cannot be negative.
> In case of failure, displaying exact error message to console is handled
> in create_ipsec_esp_flow function.So it is not required to print the
> error message again using strerror.
> This patch will remove the unnecessary calling of strerror function
> to fix the negative argument passing to strerror issue.
>
> Coverity issue: 357691
> Fixes: 6738c0a95695 ("examples/ipsec-secgw: support flow director")
> Cc: praveen.shetty@intel.com
>
> Signed-off-by: Praveen Shetty <praveen.shetty@intel.com>
> Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
> ---
> v2 changes:
> changed commit headline and rephrased commit message.
>
>   examples/ipsec-secgw/sa.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
> index e3a1a5aff..632482176 100644
> --- a/examples/ipsec-secgw/sa.c
> +++ b/examples/ipsec-secgw/sa.c
> @@ -1223,8 +1223,7 @@ sa_add_rules(struct sa_ctx *sa_ctx, const struct ipsec_sa entries[],
>   			rc = create_ipsec_esp_flow(sa);
>   			if (rc != 0)
>   				RTE_LOG(ERR, IPSEC_ESP,
> -					"create_ipsec_esp_flow() failed %s\n",
> -					strerror(rc));
> +					"create_ipsec_esp_flow() failed\n");
>   		}
>   		print_one_sa_rule(sa, inbound);
>   	}
  
Shetty, Praveen May 6, 2020, 11:03 a.m. UTC | #2
-----Original Message-----
From: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com> 
Sent: Wednesday, May 6, 2020 4:20 PM
To: Shetty, Praveen <praveen.shetty@intel.com>; dev@dpdk.org; Doherty, Declan <declan.doherty@intel.com>; akhil.goyal@nxp.com; anoobj@marvell.com
Cc: Iremonger, Bernard <bernard.iremonger@intel.com>; Ananyev, Konstantin <konstantin.ananyev@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2] examples/ipsec-secgw: fix negative argument passing


W dniu 06.05.2020 o 12:37, Praveen Shetty pisze:
> Function create_ipsec_esp_flow returns a negative number in case of 
> any failure and we are passing this to strerror to dsiplay the error message.
typo dsiplay -> display

[Praveen] Thanks, fixed in v3.

> But strerror()'s argument cannot be negative.
> In case of failure, displaying exact error message to console is 
> handled in create_ipsec_esp_flow function.So it is not required to 
> print the error message again using strerror.
> This patch will remove the unnecessary calling of strerror function to 
> fix the negative argument passing to strerror issue.
>
> Coverity issue: 357691
> Fixes: 6738c0a95695 ("examples/ipsec-secgw: support flow director")
> Cc: praveen.shetty@intel.com
>
> Signed-off-by: Praveen Shetty <praveen.shetty@intel.com>
> Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
> ---
> v2 changes:
> changed commit headline and rephrased commit message.
>
>   examples/ipsec-secgw/sa.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c 
> index e3a1a5aff..632482176 100644
> --- a/examples/ipsec-secgw/sa.c
> +++ b/examples/ipsec-secgw/sa.c
> @@ -1223,8 +1223,7 @@ sa_add_rules(struct sa_ctx *sa_ctx, const struct ipsec_sa entries[],
>   			rc = create_ipsec_esp_flow(sa);
>   			if (rc != 0)
>   				RTE_LOG(ERR, IPSEC_ESP,
> -					"create_ipsec_esp_flow() failed %s\n",
> -					strerror(rc));
> +					"create_ipsec_esp_flow() failed\n");
>   		}
>   		print_one_sa_rule(sa, inbound);
>   	}
  
Lukasz Wojciechowski May 6, 2020, 11:45 a.m. UTC | #3
W dniu 06.05.2020 o 13:03, Shetty, Praveen pisze:
>
> -----Original Message-----
> From: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
> Sent: Wednesday, May 6, 2020 4:20 PM
> To: Shetty, Praveen <praveen.shetty@intel.com>; dev@dpdk.org; Doherty, Declan <declan.doherty@intel.com>; akhil.goyal@nxp.com; anoobj@marvell.com
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>; Ananyev, Konstantin <konstantin.ananyev@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2] examples/ipsec-secgw: fix negative argument passing
>
>
> W dniu 06.05.2020 o 12:37, Praveen Shetty pisze:
>> Function create_ipsec_esp_flow returns a negative number in case of
>> any failure and we are passing this to strerror to dsiplay the error message.
> typo dsiplay -> display
>
> [Praveen] Thanks, fixed in v3.
>
>> But strerror()'s argument cannot be negative.
>> In case of failure, displaying exact error message to console is
>> handled in create_ipsec_esp_flow function.So it is not required to
>> print the error message again using strerror.
>> This patch will remove the unnecessary calling of strerror function to
>> fix the negative argument passing to strerror issue.
>>
>> Coverity issue: 357691
>> Fixes: 6738c0a95695 ("examples/ipsec-secgw: support flow director")
>> Cc: praveen.shetty@intel.com
>>
>> Signed-off-by: Praveen Shetty <praveen.shetty@intel.com>
>> Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
>> ---
>> v2 changes:
>> changed commit headline and rephrased commit message.
>>
>>    examples/ipsec-secgw/sa.c | 3 +--
>>    1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
>> index e3a1a5aff..632482176 100644
>> --- a/examples/ipsec-secgw/sa.c
>> +++ b/examples/ipsec-secgw/sa.c
>> @@ -1223,8 +1223,7 @@ sa_add_rules(struct sa_ctx *sa_ctx, const struct ipsec_sa entries[],
>>    			rc = create_ipsec_esp_flow(sa);
>>    			if (rc != 0)
>>    				RTE_LOG(ERR, IPSEC_ESP,
>> -					"create_ipsec_esp_flow() failed %s\n",
>> -					strerror(rc));
>> +					"create_ipsec_esp_flow() failed\n");
>>    		}
>>    		print_one_sa_rule(sa, inbound);
>>    	}
Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
>
  

Patch

diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
index e3a1a5aff..632482176 100644
--- a/examples/ipsec-secgw/sa.c
+++ b/examples/ipsec-secgw/sa.c
@@ -1223,8 +1223,7 @@  sa_add_rules(struct sa_ctx *sa_ctx, const struct ipsec_sa entries[],
 			rc = create_ipsec_esp_flow(sa);
 			if (rc != 0)
 				RTE_LOG(ERR, IPSEC_ESP,
-					"create_ipsec_esp_flow() failed %s\n",
-					strerror(rc));
+					"create_ipsec_esp_flow() failed\n");
 		}
 		print_one_sa_rule(sa, inbound);
 	}