examples/fips_validation: fix logically dead code
PATCH 1/1 examples/fips_validation: fix logically dead code
Coverity issue: 336866
Coverity issue: 336841
Coverity issue: 336838
Fixes 41d561cbdd24 ("examples/fips_validation: add power on self test")
Signed-off-by Fan Zhang <[email protected]>
--- examples/fips_validation/fips_dev_self_test.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
examples/fips_validation/fips_dev_self_test.c +12 -3
@@ -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);
Signature · 1 line
2.14.5
Quoted 61 lines
Subject: [dpdk-dev] [PATCH] examples/fips_validation: fix logically dead code
Coverity issue: 336866
Coverity issue: 336841
Coverity issue: 336838Fixes 41d561cbdd24 ("examples/fips_validation: add power on self test")Signed-off-by Fan Zhang <[email protected]>--- examples/fips_validation/fips_dev_self_test.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)examples/fips_validation/fips_dev_self_test.c +8
-2@@ -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,examples/fips_validation/fips_dev_self_test.c +3
-0uint32_t len, src_len;int ret; +if (!mbuf) +return -1 ; +if (op->sym->aead.aad.data)rte_free (op->sym->aead.aad.data);
examples/fips_validation/fips_dev_self_test.c check_aead_result(struct rte_crypto_op *op,
Quoted 9 lines
examples/fips_validation/fips_dev_self_test.c +1
-2@@ -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); --
Acked-by Marko Kovacevic <[email protected]>
Akhil Goyal
AppliedQuoted 8 lines
Quoted 8 lines
Coverity issue: 336866
Coverity issue: 336841
Coverity issue: 336838Fixes 41d561cbdd24 ("examples/fips_validation: add power on self test")
Quoted 4 lines
Quoted 2 lines
Signed-off-by Fan Zhang <[email protected]>---
Acked-by Marko Kovacevic <[email protected]>
Applied to dpdk-next-crypto
Thanks