Skip to content

Commit

Permalink
test/crypto: fix build with GCC 11
Browse files Browse the repository at this point in the history
[ upstream commit 8f73a72 ]

Fix the allocation for sessions, to prevent an array-bounds
warning with GCC 11. Set the not created session to NULL.

Fixes: 202d375 ("app/test: add cryptodev unit and performance tests")

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
  • Loading branch information
kevintraynor authored and steevenlee committed Jun 8, 2021
1 parent 18918e1 commit 87eec97
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/test/test_cryptodev.c
Expand Up @@ -10411,8 +10411,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++) {
Expand Down Expand Up @@ -10457,6 +10457,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,
Expand Down

0 comments on commit 87eec97

Please sign in to comment.