[PATCH] app/test: fix stack overflow in lpm6_perf_autotest

Medvedkin, Vladimir vladimir.medvedkin at intel.com
Fri Dec 13 11:22:20 CET 2024


Hi Andre,

On 13/12/2024 02:39, Andre Muezerie wrote:
> Test lpm6_perf_autotest was hitting a stack overflow on Windows
> with both MSVC and Clang.
>
> The fix is to move some of the data from the stack to the heap.
>
> Signed-off-by: Andre Muezerie <andremue at linux.microsoft.com>
> ---
>   app/test/test_lpm6_perf.c | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/app/test/test_lpm6_perf.c b/app/test/test_lpm6_perf.c
> index 1860a99ed6..8231ad825d 100644
> --- a/app/test/test_lpm6_perf.c
> +++ b/app/test/test_lpm6_perf.c
> @@ -117,8 +117,12 @@ test_lpm6_perf(void)
>   	total_time = 0;
>   	count = 0;
>   
> -	struct rte_ipv6_addr ip_batch[NUM_IPS_ENTRIES];
> -	int32_t next_hops[NUM_IPS_ENTRIES];
> +	struct rte_ipv6_addr *ip_batch = (struct rte_ipv6_addr *)malloc(
why not rte_malloc?
> +			sizeof(struct rte_ipv6_addr) * NUM_IPS_ENTRIES);
> +	TEST_LPM_ASSERT(ip_batch != NULL);
> +
> +	int32_t *next_hops = (int32_t *)malloc(sizeof(int32_t) * NUM_IPS_ENTRIES);
> +	TEST_LPM_ASSERT(next_hops != NULL);
>   
>   	for (i = 0; i < NUM_IPS_ENTRIES; i++)
>   		ip_batch[i] = large_ips_table[i].ip;
> @@ -153,6 +157,9 @@ test_lpm6_perf(void)
>   	printf("Average LPM Delete: %g cycles\n",
>   			(double)total_time / NUM_ROUTE_ENTRIES);
>   
> +	free(next_hops);
> +	free(ip_batch);
> +
>   	rte_lpm6_delete_all(lpm);
>   	rte_lpm6_free(lpm);
>   

-- 
Regards,
Vladimir



More information about the dev mailing list