From: Fan Zhang <roy.fan.zhang@intel.com>
To: dev@dpdk.org
Cc: akhil.goyal@nxp.com, Fan Zhang <roy.fan.zhang@intel.com>
Subject: [dpdk-dev] [PATCH] examples/fips_validation: fix logically dead code
Date: Wed, 15 May 2019 16:41:21 +0100 [thread overview]
Message-ID: <20190515154121.75459-1-roy.fan.zhang@intel.com> (raw)
Message-ID: <20190515154121.CRBjdc52TUbvLVBDjQlk58oH0ztH6jTWiaBMLbVwRQs@z> (raw)
Coverity issue: 336866
Coverity issue: 336841
Coverity issue: 336838
Fixes: 41d561cbdd24 ("examples/fips_validation: add power on self test")
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
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 df1c0e82e..444bbaa79 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.14.5
next reply other threads:[~2019-05-15 15:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-15 15:41 Fan Zhang [this message]
2019-05-15 15:41 ` Fan Zhang
2019-06-17 11:10 ` Kovacevic, Marko
2019-06-19 14:56 ` Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190515154121.75459-1-roy.fan.zhang@intel.com \
--to=roy.fan.zhang@intel.com \
--cc=akhil.goyal@nxp.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).