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 <ktraynor@redhat.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
This commit is contained in:
Kevin Traynor 2021-05-05 09:53:14 +01:00 committed by Akhil Goyal
parent 05577f145e
commit 8f73a72378

View File

@ -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,