summaryrefslogtreecommitdiff
path: root/examples/fips_validation
diff options
context:
space:
mode:
authorFan Zhang <roy.fan.zhang@intel.com>2019-05-15 16:41:21 +0100
committerAkhil Goyal <akhil.goyal@nxp.com>2019-07-05 14:52:25 +0200
commit6da6a83ee0f512d5eff0cce8725651cd407e81da (patch)
treec102d3c221b6211b22e3adde1e332a555286990a /examples/fips_validation
parenta3f9fededfca6758abb751d67b11cda660a3399a (diff)
downloaddpdk-6da6a83ee0f512d5eff0cce8725651cd407e81da.zip
dpdk-6da6a83ee0f512d5eff0cce8725651cd407e81da.tar.gz
dpdk-6da6a83ee0f512d5eff0cce8725651cd407e81da.tar.xz
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 <roy.fan.zhang@intel.com> Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
Diffstat (limited to 'examples/fips_validation')
-rw-r--r--examples/fips_validation/fips_dev_self_test.c15
1 files 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 df1c0e8..444bbaa 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);