* [dpdk-dev] [PATCH] crypto/cnxk: add null check for rsa param key data
@ 2021-07-26 4:44 kirankumark
2021-07-27 17:52 ` [dpdk-dev] [EXT] " Akhil Goyal
0 siblings, 1 reply; 2+ messages in thread
From: kirankumark @ 2021-07-26 4:44 UTC (permalink / raw)
To: Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj; +Cc: dev, Kiran Kumar K
From: Kiran Kumar K <kirankumark@marvell.com>
Coverity is reporting FORWARD_NULL issue when qt data is NULL.
Adding NULL check for this.
Coverity issue: 371893
Fixes: 5a3513caeb455 ("crypto/cnxk: add asymmetric session ops")
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
---
drivers/crypto/cnxk/cnxk_ae.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/cnxk/cnxk_ae.h b/drivers/crypto/cnxk/cnxk_ae.h
index c752e62ea5..a71e7ee8a2 100644
--- a/drivers/crypto/cnxk/cnxk_ae.h
+++ b/drivers/crypto/cnxk/cnxk_ae.h
@@ -85,6 +85,9 @@ cnxk_ae_fill_rsa_params(struct cnxk_ae_sess *sess,
size_t len = (mod_len / 2);
uint64_t total_size;
+ if (qt.p.length != 0 && qt.p.data == NULL)
+ return -EINVAL;
+
/* Make sure key length used is not more than mod_len/2 */
if (qt.p.data != NULL)
len = RTE_MIN(len, qt.p.length);
@@ -109,7 +112,8 @@ cnxk_ae_fill_rsa_params(struct cnxk_ae_sess *sess,
rsa->qt.dQ.data = rsa->qt.q.data + qt.q.length;
memcpy(rsa->qt.dQ.data, qt.dQ.data, qt.dQ.length);
rsa->qt.p.data = rsa->qt.dQ.data + qt.dQ.length;
- memcpy(rsa->qt.p.data, qt.p.data, qt.p.length);
+ if (qt.p.data != NULL)
+ memcpy(rsa->qt.p.data, qt.p.data, qt.p.length);
rsa->qt.dP.data = rsa->qt.p.data + qt.p.length;
memcpy(rsa->qt.dP.data, qt.dP.data, qt.dP.length);
rsa->qt.qInv.data = rsa->qt.dP.data + qt.dP.length;
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [EXT] [PATCH] crypto/cnxk: add null check for rsa param key data
2021-07-26 4:44 [dpdk-dev] [PATCH] crypto/cnxk: add null check for rsa param key data kirankumark
@ 2021-07-27 17:52 ` Akhil Goyal
0 siblings, 0 replies; 2+ messages in thread
From: Akhil Goyal @ 2021-07-27 17:52 UTC (permalink / raw)
To: Kiran Kumar Kokkilagadda, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj
Cc: dev, Kiran Kumar Kokkilagadda
> Coverity is reporting FORWARD_NULL issue when qt data is NULL.
> Adding NULL check for this.
>
> Coverity issue: 371893
> Fixes: 5a3513caeb455 ("crypto/cnxk: add asymmetric session ops")
>
> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
Applied to dpdk-next-crypto
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-27 17:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26 4:44 [dpdk-dev] [PATCH] crypto/cnxk: add null check for rsa param key data kirankumark
2021-07-27 17:52 ` [dpdk-dev] [EXT] " 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).