From 8f73a72378333a68ada948ad648f9c6f925af58b Mon Sep 17 00:00:00 2001 From: Kevin Traynor Date: Wed, 5 May 2021 09:53:14 +0100 Subject: [PATCH] test/crypto: fix build with GCC 11 Fix the allocation for sessions, to prevent an array-bounds warning with GCC 11. Set the not created session to NULL. Fixes: 202d375c60bc ("app/test: add cryptodev unit and performance tests") Cc: stable@dpdk.org Signed-off-by: Kevin Traynor Acked-by: Akhil Goyal --- app/test/test_cryptodev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index c68684b80b..39db52b17a 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -10748,8 +10748,8 @@ test_multi_session(void) rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); sessions = rte_malloc(NULL, - (sizeof(struct rte_cryptodev_sym_session *) * - MAX_NB_SESSIONS) + 1, 0); + sizeof(struct rte_cryptodev_sym_session *) * + (MAX_NB_SESSIONS + 1), 0); /* Create multiple crypto sessions*/ for (i = 0; i < MAX_NB_SESSIONS; i++) { @@ -10794,6 +10794,7 @@ test_multi_session(void) } } + sessions[i] = NULL; /* Next session create should fail */ rte_cryptodev_sym_session_init(ts_params->valid_devs[0], sessions[i], &ut_params->auth_xform, -- 2.20.1