From 6da6a83ee0f512d5eff0cce8725651cd407e81da Mon Sep 17 00:00:00 2001 From: Fan Zhang Date: Wed, 15 May 2019 16:41:21 +0100 Subject: [PATCH] examples/fips_validation: fix logically dead code Coverity issue: 336866, 336841, 336838 Fixes: 41d561cbdd24 ("examples/fips_validation: add power on self test") Cc: stable@dpdk.org Signed-off-by: Fan Zhang Acked-by: Marko Kovacevic --- examples/fips_validation/fips_dev_self_test.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/examples/fips_validation/fips_dev_self_test.c b/examples/fips_validation/fips_dev_self_test.c index df1c0e82e8..444bbaa796 100644 --- a/examples/fips_validation/fips_dev_self_test.c +++ b/examples/fips_validation/fips_dev_self_test.c @@ -1333,6 +1333,9 @@ check_cipher_result(struct rte_crypto_op *op, uint32_t len, src_len; int ret; + if (!mbuf) + return -1; + if (dir == self_test_dir_enc_auth_gen) { src = vec->output.data; src_len = vec->output.len; @@ -1342,7 +1345,7 @@ check_cipher_result(struct rte_crypto_op *op, } GET_MBUF_DATA(data, len, mbuf); - if (!data && !len) + if (!len) return -1; ret = memcmp(data, src, src_len); @@ -1362,8 +1365,11 @@ check_auth_result(struct rte_crypto_op *op, uint32_t len; int ret; + if (mbuf == NULL) + return -1; + GET_MBUF_DATA(data, len, mbuf); - if (!data && !len) + if (!len) return -1; if (dir == self_test_dir_enc_auth_gen) { @@ -1387,6 +1393,9 @@ check_aead_result(struct rte_crypto_op *op, uint32_t len, src_len; int ret; + if (!mbuf) + return -1; + if (op->sym->aead.aad.data) rte_free(op->sym->aead.aad.data); @@ -1399,7 +1408,7 @@ check_aead_result(struct rte_crypto_op *op, } GET_MBUF_DATA(data, len, mbuf); - if (!data && !len) + if (!len) return -1; ret = memcmp(data, src, src_len); -- 2.20.1