The asymmetric op pool name buffer is 32 bytes but snprintf is given
RTE_MEMPOOL_NAMESIZE as the size. This is harmless only as long as
RTE_MEMPOOL_NAMESIZE is not larger than 32.
Size the buffer with RTE_MEMPOOL_NAMESIZE and use sizeof() for the
snprintf limit, as the symmetric path already does.
Fixes: ba588ce3f933 ("test/crypto-perf: test asymmetric crypto throughput")
Signed-off-by: Stephen Hemminger <[email protected]>
---
app/test-crypto-perf/cperf_test_common.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/test-crypto-perf/cperf_test_common.c
b/app/test-crypto-perf/cperf_test_common.c
index 0bcaa6dfd8..b2eabf470e 100644
--- a/app/test-crypto-perf/cperf_test_common.c
+++ b/app/test-crypto-perf/cperf_test_common.c
@@ -145,7 +145,7 @@ cperf_alloc_common_memory(const struct cperf_options
*options,
struct rte_mempool **pool)
{
const char *mp_ops_name;
- char pool_name[32] = "";
+ char pool_name[RTE_MEMPOOL_NAMESIZE] = "";
int ret;
/* Calculate the object size */
@@ -154,7 +154,7 @@ cperf_alloc_common_memory(const struct cperf_options
*options,
if (cperf_is_asym_test(options)) {
crypto_op_size += sizeof(struct rte_crypto_asym_op);
- snprintf(pool_name, RTE_MEMPOOL_NAMESIZE, "perf_asym_op_pool%u",
+ snprintf(pool_name, sizeof(pool_name), "perf_asym_op_pool%u",
rte_socket_id());
*pool = rte_crypto_op_pool_create(
pool_name, RTE_CRYPTO_OP_TYPE_ASYMMETRIC,
--
2.53.0