From: Rahul Lakkireddy Date: Mon, 13 Jun 2022 09:52:23 +0000 (+0530) Subject: test/crypto: fix build with optimization=1 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=694c75e8e3e73fe9a6c55760e39365266daad5b7;p=dpdk.git test/crypto: fix build with optimization=1 Fail IPSec ESN and antireplay cases, if there are no packets. Fixes following warning when using optimization=1 build flag with GCC 11. ../app/test/test_cryptodev.c: In function ‘test_ipsec_pkt_replay’: ../app/test/test_cryptodev.c:10074:15: warning: ‘td_outb’ may be used uninitialized [-Wmaybe-uninitialized] ret = test_ipsec_proto_process(td_outb, td_inb, nb_pkts, true, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ &flags); ~~~~~~~ ../app/test/test_cryptodev.c:9150:1: note: by argument 1 of type ‘const struct ipsec_test_data[]’ to ‘test_ipsec_proto_process’ declared here test_ipsec_proto_process(const struct ipsec_test_data td[], ^~~~~~~~~~~~~~~~~~~~~~~~ ../app/test/test_cryptodev.c:10056:32: note: ‘td_outb’ declared here struct ipsec_test_data td_outb[IPSEC_TEST_PACKETS_MAX]; ^~~~~~~ Bugzilla ID: 1032 Fixes: d02c6bfcb99a ("test/crypto: add ESN and antireplay cases") Cc: stable@dpdk.org Reported-by: Daxue Gao Signed-off-by: Rahul Lakkireddy Acked-by: Anoob Joseph --- diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 38c8ea3d3c..15df53a1f0 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -10056,6 +10056,9 @@ test_ipsec_pkt_replay(const void *test_data, const uint64_t esn[], struct ipsec_test_flags flags; uint32_t i = 0, ret = 0; + if (nb_pkts == 0) + return TEST_FAILED; + memset(&flags, 0, sizeof(flags)); flags.antireplay = true;