* [dpdk-dev] [PATCH] examples/fips_validation: fix logically dead code
@ 2019-05-15 15:41 Fan Zhang
2019-05-15 15:41 ` Fan Zhang
2019-06-17 11:10 ` Kovacevic, Marko
0 siblings, 2 replies; 4+ messages in thread
From: Fan Zhang @ 2019-05-15 15:41 UTC (permalink / raw)
To: dev; +Cc: akhil.goyal, Fan Zhang
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [PATCH] examples/fips_validation: fix logically dead code
2019-05-15 15:41 [dpdk-dev] [PATCH] examples/fips_validation: fix logically dead code Fan Zhang
@ 2019-05-15 15:41 ` Fan Zhang
2019-06-17 11:10 ` Kovacevic, Marko
1 sibling, 0 replies; 4+ messages in thread
From: Fan Zhang @ 2019-05-15 15:41 UTC (permalink / raw)
To: dev; +Cc: akhil.goyal, Fan Zhang
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] examples/fips_validation: fix logically dead code
2019-05-15 15:41 [dpdk-dev] [PATCH] examples/fips_validation: fix logically dead code Fan Zhang
2019-05-15 15:41 ` Fan Zhang
@ 2019-06-17 11:10 ` Kovacevic, Marko
2019-06-19 14:56 ` Akhil Goyal
1 sibling, 1 reply; 4+ messages in thread
From: Kovacevic, Marko @ 2019-06-17 11:10 UTC (permalink / raw)
To: Zhang, Roy Fan, dev; +Cc: akhil.goyal, Zhang, Roy Fan
> Subject: [dpdk-dev] [PATCH] 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 <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);
> --
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] examples/fips_validation: fix logically dead code
2019-06-17 11:10 ` Kovacevic, Marko
@ 2019-06-19 14:56 ` Akhil Goyal
0 siblings, 0 replies; 4+ messages in thread
From: Akhil Goyal @ 2019-06-19 14:56 UTC (permalink / raw)
To: Kovacevic, Marko, Zhang, Roy Fan, dev; +Cc: Zhang, Roy Fan, stable
> >
> > 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>
> > ---
>
> Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
Cc: stable@dpdk.org
Applied to dpdk-next-crypto
Thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-06-19 14:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-15 15:41 [dpdk-dev] [PATCH] examples/fips_validation: fix logically dead code Fan Zhang
2019-05-15 15:41 ` Fan Zhang
2019-06-17 11:10 ` Kovacevic, Marko
2019-06-19 14:56 ` Akhil Goyal
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).