diff mbox series

[1/2] crypto/dpaa_sec: improve the error checking

Message ID 1522917349-19049-1-git-send-email-hemant.agrawal@nxp.com
State New
Headers show
Series [1/2] crypto/dpaa_sec: improve the error checking | expand

Commit Message

Hemant Agrawal April 5, 2018, 8:35 a.m. UTC
From: Sunil Kumar Kori <sunil.kori@nxp.com>


Reported by NXP's internal coverity

Signed-off-by: Sunil Kumar Kori <sunil.kori@nxp.com>

---
 drivers/crypto/dpaa_sec/dpaa_sec.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

-- 
2.7.4

Comments

Akhil Goyal April 16, 2018, 9:13 a.m. UTC | #1
On 4/5/2018 2:05 PM, Hemant Agrawal wrote:
> From: Sunil Kumar Kori <sunil.kori@nxp.com>

>

> Reported by NXP's internal coverity

>

> Signed-off-by: Sunil Kumar Kori <sunil.kori@nxp.com>

> ---

>  drivers/crypto/dpaa_sec/dpaa_sec.c | 8 +++++++-

>  1 file changed, 7 insertions(+), 1 deletion(-)

>

Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
De Lara Guarch, Pablo April 17, 2018, 2:42 p.m. UTC | #2
> -----Original Message-----

> From: Akhil Goyal [mailto:akhil.goyal@nxp.com]

> Sent: Monday, April 16, 2018 10:14 AM

> To: Hemant Agrawal <hemant.agrawal@nxp.com>; dev@dpdk.org

> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; dpdk-

> up@NXP1.onmicrosoft.com

> Subject: Re: [PATCH 1/2] crypto/dpaa_sec: improve the error checking

> 

> On 4/5/2018 2:05 PM, Hemant Agrawal wrote:

> > From: Sunil Kumar Kori <sunil.kori@nxp.com>

> >

> > Reported by NXP's internal coverity

> >

> > Signed-off-by: Sunil Kumar Kori <sunil.kori@nxp.com>

> > ---

> >  drivers/crypto/dpaa_sec/dpaa_sec.c | 8 +++++++-

> >  1 file changed, 7 insertions(+), 1 deletion(-)

> >

> Acked-by: Akhil Goyal <akhil.goyal@nxp.com>


Added Fixes line and CC'd stable.

Applied to dpdk-next-crypto.
Thanks,

Pablo
diff mbox series

Patch

diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index c5191ce..79ccb22 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -388,7 +388,7 @@  static int
 dpaa_sec_prep_cdb(dpaa_sec_session *ses)
 {
 	struct alginfo alginfo_c = {0}, alginfo_a = {0}, alginfo = {0};
-	uint32_t shared_desc_len = 0;
+	int32_t shared_desc_len = 0;
 	struct sec_cdb *cdb = &ses->cdb;
 	int err;
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
@@ -530,6 +530,12 @@  dpaa_sec_prep_cdb(dpaa_sec_session *ses)
 					ses->digest_length, ses->dir);
 		}
 	}
+
+	if (shared_desc_len < 0) {
+		PMD_TX_LOG(ERR, "error in preparing command block\n");
+		return shared_desc_len;
+	}
+
 	cdb->sh_hdr.hi.field.idlen = shared_desc_len;
 	cdb->sh_hdr.hi.word = rte_cpu_to_be_32(cdb->sh_hdr.hi.word);
 	cdb->sh_hdr.lo.word = rte_cpu_to_be_32(cdb->sh_hdr.lo.word);