Skip to contentSkip to conversation

examples/ipsec-secgw: resolve coverity issue

PATCH In review Praveen Shetty 4 participants 11 messages May 6, 2020 – May 9, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 examples/ipsec-secgw: resolve coverity issue

Function create_ipsec_esp_flow returns a negative number in case of any failure. But passing negative number to strerror is causing the coverity issue.
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 coverity issue.

Coverity issue: 357691

Fixes 6738c0a95695 ("examples/ipsec-secgw: support flow director")
---
 examples/ipsec-secgw/sa.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
examples/ipsec-secgw/sa.c +1 -2
index e3a1a5aff..632482176 100644
@@ -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);
 	}
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw

W dniu 06.05.2020 o 11:02, Praveen Shetty pisze:

Quoted 23 lines

Function create_ipsec_esp_flow returns a negative number in case of any failure. But passing negative number to strerror is causing the coverity issue.
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 coverity issue.

Coverity issue: 357691

Fixes 6738c0a95695 ("examples/ipsec-secgw: support flow director")
---
  examples/ipsec-secgw/sa.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
examples/ipsec-secgw/sa.c +0 -0
index e3a1a5aff..632482176 100644

examples/ipsec-secgw/sa.c sa_add_rules(struct sa_ctx *sa_ctx, const struct ipsec_sa entries[], · line 1229

Quoted 9 lines
examples/ipsec-secgw/sa.c +1 -2
@@ -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);
  	}

great!, especially that create_ipsec_esp_flow returns mostly -1 in case of errors and that would be -EPERM ;)

Signature · 7 lines
Lukasz Wojciechowski
Principal Software Engineer

Samsung R&D Institute Poland
Samsung Electronics
Office +48 22 377 88 25
[email protected]
#2 lore raw
In reply to Praveen Shetty

Hi Praveen,

Please see inline.

Thanks,
Anoob

Quoted 8 lines

-----Original Message-----
From: Praveen Shetty <[email protected]>
Sent: Wednesday, May 6, 2020 2:33 PM
To: [email protected]; [email protected]; [email protected]; Anoob Joseph <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: [EXT] [PATCH v1] examples/ipsec-secgw: resolve coverity issue

[Anoob] I believe Thomas insists on explaining the issue that you are trying to fix rather than stating "resolve coverity issue" (which is too generic). So I guess you can remove all such references to coverity and retain rest of your description.

Quoted 38 lines

External Email

----------------------------------------------------------------------
Function create_ipsec_esp_flow returns a negative number in case of any failure. But passing negative number to strerror is causing the coverity issue. 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 coverity issue.

Coverity issue: 357691

Fixes 6738c0a95695 ("examples/ipsec-secgw: support flow director")
---
 examples/ipsec-secgw/sa.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
examples/ipsec-secgw/sa.c index renamed from examples/ipsec-secgw/sa.c +0 -0

e3a1a5aff..632482176 100644

examples/ipsec-secgw/sa.c +1 -2
@@ -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);

}
--
2.17.1

#3 lore raw

Hi Anoob,

Thank you.

I have modified the commit message and headline accordingly and sent v2.

Regards,
Praveen

-----Original Message-----
From: Anoob Joseph <[email protected]>
Sent: Wednesday, May 6, 2020 3:13 PM
To: Shetty, Praveen <[email protected]>; [email protected]; Doherty, Declan <[email protected]>; [email protected]
Cc: Iremonger, Bernard <[email protected]>; Ananyev, Konstantin <[email protected]>
Subject: RE: [EXT] [PATCH v1] examples/ipsec-secgw: resolve coverity issue

Hi Praveen,

Please see inline.

Thanks,
Anoob

Quoted 8 lines

-----Original Message-----
From: Praveen Shetty <[email protected]>
Sent: Wednesday, May 6, 2020 2:33 PM
To: [email protected]; [email protected]; [email protected]; Anoob Joseph <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: [EXT] [PATCH v1] examples/ipsec-secgw: resolve coverity issue

[Anoob] I believe Thomas insists on explaining the issue that you are trying to fix rather than stating "resolve coverity issue" (which is too generic). So I guess you can remove all such references to coverity and retain rest of your description.

Quoted 39 lines

External Email

----------------------------------------------------------------------
Function create_ipsec_esp_flow returns a negative number in case of any failure. But passing negative number to strerror is causing the coverity issue. 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 coverity issue.

Coverity issue: 357691

Fixes 6738c0a95695 ("examples/ipsec-secgw: support flow director")
---
 examples/ipsec-secgw/sa.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
examples/ipsec-secgw/sa.c +0 -0

index
e3a1a5aff..632482176 100644

examples/ipsec-secgw/sa.c +1 -2
@@ -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);

}
--
2.17.1

#4 lore raw

PATCH v2 1/1 examples/ipsec-secgw: fix negative argument passing

In reply to Praveen Shetty

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

---
v2 changes:
changed commit headline and rephrased commit message.

 examples/ipsec-secgw/sa.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
examples/ipsec-secgw/sa.c +1 -2
index e3a1a5aff..632482176 100644
@@ -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);
 	}
Signature · 1 line
2.17.1
#5 lore raw

Re: [dpdk-dev] [PATCH v2] examples/ipsec-secgw: fix negative argument passing

W dniu 06.05.2020 o 12:37, Praveen Shetty pisze:

Quoted 2 lines

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

Quoted 34 lines

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

---
v2 changes:
changed commit headline and rephrased commit message.

  examples/ipsec-secgw/sa.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
examples/ipsec-secgw/sa.c +1 -2
index e3a1a5aff..632482176 100644
@@ -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);
  	}
Signature · 7 lines
Lukasz Wojciechowski
Principal Software Engineer

Samsung R&D Institute Poland
Samsung Electronics
Office +48 22 377 88 25
[email protected]
#6 lore raw

Re: [dpdk-dev] [PATCH v2] examples/ipsec-secgw: fix negative argument passing

-----Original Message-----
From: Lukasz Wojciechowski <[email protected]>
Sent: Wednesday, May 6, 2020 4:20 PM
To: Shetty, Praveen <[email protected]>; [email protected]; Doherty, Declan <[email protected]>; [email protected]; [email protected]
Cc: Iremonger, Bernard <[email protected]>; Ananyev, Konstantin <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] examples/ipsec-secgw: fix negative argument passing

W dniu 06.05.2020 o 12:37, Praveen Shetty pisze:

Quoted 2 lines

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.

Quoted 34 lines

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

---
v2 changes:
changed commit headline and rephrased commit message.

  examples/ipsec-secgw/sa.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
examples/ipsec-secgw/sa.c +1 -2
index e3a1a5aff..632482176 100644
@@ -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);
  	}
Signature · 7 lines
Lukasz Wojciechowski
Principal Software Engineer

Samsung R&D Institute Poland
Samsung Electronics
Office +48 22 377 88 25
[email protected]
#7 lore raw

Re: [dpdk-dev] [PATCH v2] examples/ipsec-secgw: fix negative argument passing

W dniu 06.05.2020 o 13:03, Shetty, Praveen pisze:

Quoted 36 lines

-----Original Message-----
From: Lukasz Wojciechowski <[email protected]>
Sent: Wednesday, May 6, 2020 4:20 PM
To: Shetty, Praveen <[email protected]>; [email protected]; Doherty, Declan <[email protected]>; [email protected]; [email protected]
Cc: Iremonger, Bernard <[email protected]>; Ananyev, Konstantin <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] examples/ipsec-secgw: fix negative argument passing

W dniu 06.05.2020 o 12:37, Praveen Shetty pisze:

Quoted 2 lines

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.

Quoted 20 lines

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

---
v2 changes:
changed commit headline and rephrased commit message.

   examples/ipsec-secgw/sa.c | 3 +--
   1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 14 lines
Quoted 5 lines
examples/ipsec-secgw/sa.c +0 -0
index e3a1a5aff..632482176 100644

examples/ipsec-secgw/sa.c sa_add_rules(struct sa_ctx *sa_ctx, const struct ipsec_sa entries[], · line 1229

Quoted 9 lines
examples/ipsec-secgw/sa.c +1 -2
@@ -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);
   	}
Quoted 1 line
Signature · 7 lines
Lukasz Wojciechowski
Principal Software Engineer

Samsung R&D Institute Poland
Samsung Electronics
Office +48 22 377 88 25
[email protected]
#8 lore raw

PATCH v3 1/1 examples/ipsec-secgw: fix negative argument passing

In reply to Praveen Shetty

Function create_ipsec_esp_flow returns a negative number in case of any failure and we are passing this to strerror to display 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")

---
v3 changes:
fixed typo in commit message.

 examples/ipsec-secgw/sa.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
examples/ipsec-secgw/sa.c +1 -2
index e3a1a5aff..632482176 100644
@@ -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);
 	}
Signature · 1 line
2.17.1
Acked-by on v3 1/1
#9 lore raw

Re: [dpdk-dev] [EXT] [PATCH v3] examples/ipsec-secgw: fix negative argument passing

Quoted 10 lines

Function create_ipsec_esp_flow returns a negative number in case of any failure and we are passing this to strerror to display 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.

Quoted 6 lines

Coverity issue: 357691

Fixes 6738c0a95695 ("examples/ipsec-secgw: support flow director")
Applied
#10 lore raw

Re: [dpdk-dev] [EXT] [PATCH v3] examples/ipsec-secgw: fix negative argument passing

Quoted 10 lines
Quoted 1 line

Function create_ipsec_esp_flow returns a negative number in case of any

failure

Quoted 8 lines

and we are passing this to strerror to display 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.

Quoted 8 lines
Quoted 6 lines

Coverity issue: 357691

Fixes 6738c0a95695 ("examples/ipsec-secgw: support flow director")

Applied to dpdk-next-crypto

Thanks.