Skip to contentSkip to conversation

fips validation app fixes

PATCH In review Ciara Power 3 participants 6 messages Aug 12, 2021 – Oct 5, 2021

lore
Share & tools
lore
#0 lore raw

cover fips validation app fixes

Included are patches with small fixes for unnecessary memory allocation, and incomplete resetting of a pointer.

Ciara Power (2):
examples/fips_validation: fix unused malloc
examples/fips_validation: fix resetting pointer

 examples/fips_validation/main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 examples/fips_validation: fix unused malloc

The val.val pointer is allocated memory, however this memory is then freed in get_writeback_data() without being used beforehand. The pointer is then allocated memory again before use,
so the very first allocation is removed as it was unnecessary.

Fixes f4797bae0050 ("examples/fips_validation: support plain SHA")
---
 examples/fips_validation/main.c | 1 -
 1 file changed, 1 deletion(-)
examples/fips_validation/main.c +0 -1
index c175fe6ac2..2db00620ce 100644
@@ -1635,7 +1635,6 @@ fips_mct_sha_test(void)
 	int ret;
 	uint32_t i, j;
 
-	val.val = rte_malloc(NULL, (MAX_DIGEST_SIZE*SHA_MD_BLOCK), 0);
 	for (i = 0; i < SHA_MD_BLOCK; i++)
 		md[i].val = rte_malloc(NULL, (MAX_DIGEST_SIZE*2), 0);
 
Signature · 1 line
2.25.1
Acked-by on v1 1/2
#2 lore raw

Re: [dpdk-dev] [PATCH v1 1/2] examples/fips_validation: fix unused malloc

Quoted 37 lines

-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Thursday, August 12, 2021 3:25 PM
To: [email protected]
Cc: [email protected]; Zhang, Roy Fan <[email protected]>; Power, Ciara <[email protected]>; [email protected]; Kovacevic, Marko <[email protected]>
Subject: [PATCH v1 1/2] examples/fips_validation: fix unused malloc

The val.val pointer is allocated memory, however this memory is then freed in get_writeback_data() without being used beforehand. The pointer is then allocated memory again before use,
so the very first allocation is removed as it was unnecessary.

Fixes f4797bae0050 ("examples/fips_validation: support plain SHA")
---
 examples/fips_validation/main.c | 1 -
 1 file changed, 1 deletion(-)
examples/fips_validation/main.c +0 -2
index c175fe6ac2..2db00620ce 100644
@@ -1635,7 +1635,6 @@ fips_mct_sha_test(void)
 	int ret;
 	uint32_t i, j;
 
-	val.val = rte_malloc(NULL, (MAX_DIGEST_SIZE*SHA_MD_BLOCK), 0);
 	for (i = 0; i < SHA_MD_BLOCK; i++)
 		md[i].val = rte_malloc(NULL, (MAX_DIGEST_SIZE*2), 0);
 
--
Quoted 1 line

2.25.1

#3 lore raw

PATCH 2/2 examples/fips_validation: fix resetting pointer

In reply to Ciara Power

The env.digest memory was freed, but the pointer was not set to NULL afterwards. This caused an "Invalid Memory" error, as the pointer tries to free twice.

Fixes 952e10cdad5e ("examples/fips_validation: support scatter gather list")
---
 examples/fips_validation/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
examples/fips_validation/main.c +3 -1
index 2db00620ce..5d14513a58 100644
@@ -1846,8 +1846,10 @@ fips_test_one_file(void)
 
 	fips_test_clear();
 
-	if (env.digest)
+	if (env.digest) {
 		rte_free(env.digest);
+		env.digest = NULL;
+	}
 	if (env.mbuf)
 		rte_pktmbuf_free(env.mbuf);
 
Signature · 1 line
2.25.1
Acked-by on v1 2/2
#4 lore raw

Re: [dpdk-dev] [PATCH v1 2/2] examples/fips_validation: fix resetting pointer

Quoted 40 lines

-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Thursday, August 12, 2021 3:25 PM
To: [email protected]
Cc: [email protected]; Zhang, Roy Fan <[email protected]>; Power, Ciara <[email protected]>; Kovacevic, Marko <[email protected]>
Subject: [PATCH v1 2/2] examples/fips_validation: fix resetting pointer

The env.digest memory was freed, but the pointer was not set to NULL afterwards. This caused an "Invalid Memory" error, as the pointer tries to free twice.

Fixes 952e10cdad5e ("examples/fips_validation: support scatter gather list")
---
 examples/fips_validation/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
examples/fips_validation/main.c +3 -2
index 2db00620ce..5d14513a58 100644
@@ -1846,8 +1846,10 @@ fips_test_one_file(void)
 
 	fips_test_clear();
 
-	if (env.digest)
+	if (env.digest) {
 		rte_free(env.digest);
+		env.digest = NULL;
+	}
 	if (env.mbuf)
 		rte_pktmbuf_free(env.mbuf);
 
--
Quoted 1 line

2.25.1

#5 lore raw
In reply to Ciara Power
Quoted 10 lines

Included are patches with small fixes for unnecessary memory allocation, and incomplete resetting of a pointer.

Ciara Power (2):
examples/fips_validation: fix unused malloc
examples/fips_validation: fix resetting pointer

 examples/fips_validation/main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Series Applied to dpdk-next-crypto

Thanks.