[v1,1/2] examples/fips_validation: fix unused malloc

Message ID 20210812142436.108053-2-ciara.power@intel.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series fips validation app fixes |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Power, Ciara Aug. 12, 2021, 2:24 p.m. UTC
  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")
Cc: damianx.nowak@intel.com
Cc: stable@dpdk.org

Signed-off-by: Ciara Power <ciara.power@intel.com>
---
 examples/fips_validation/main.c | 1 -
 1 file changed, 1 deletion(-)
  

Comments

Fan Zhang Aug. 16, 2021, 3:21 p.m. UTC | #1
> -----Original Message-----
> From: Power, Ciara <ciara.power@intel.com>
> Sent: Thursday, August 12, 2021 3:25 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Zhang, Roy Fan <roy.fan.zhang@intel.com>; Power,
> Ciara <ciara.power@intel.com>; damianx.nowak@intel.com; Kovacevic,
> Marko <marko.kovacevic@intel.com>
> 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")
> Cc: damianx.nowak@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ciara Power <ciara.power@intel.com>
> ---
>  examples/fips_validation/main.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/examples/fips_validation/main.c
> b/examples/fips_validation/main.c
> index c175fe6ac2..2db00620ce 100644
> --- a/examples/fips_validation/main.c
> +++ b/examples/fips_validation/main.c
> @@ -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);
> 
> --
> 2.25.1

Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
  

Patch

diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index c175fe6ac2..2db00620ce 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -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);