From: Kevin Traynor Date: Wed, 5 May 2021 08:53:14 +0000 (+0100) Subject: test/crypto: fix build with GCC 11 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=8f73a72378333a68ada948ad648f9c6f925af58b;p=dpdk.git 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 --- 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,