DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: dev@dpdk.org
Cc: pablo.de.lara.guarch@intel.com, akhil.goyal@nxp.com,
	dpdk-up@NXP1.onmicrosoft.com
Subject: [dpdk-dev] [PATCH 1/2] crypto/dpaa_sec: improve the error checking
Date: Thu,  5 Apr 2018 14:05:48 +0530	[thread overview]
Message-ID: <1522917349-19049-1-git-send-email-hemant.agrawal@nxp.com> (raw)

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(-)

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);
-- 
2.7.4

             reply	other threads:[~2018-04-05  8:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-05  8:35 Hemant Agrawal [this message]
2018-04-05  8:35 ` [dpdk-dev] [PATCH 2/2] crypto/dpaa2_sec: improve error handling Hemant Agrawal
2018-04-16  9:14   ` Akhil Goyal
2018-04-17 14:42     ` De Lara Guarch, Pablo
2018-04-16  9:13 ` [dpdk-dev] [PATCH 1/2] crypto/dpaa_sec: improve the error checking Akhil Goyal
2018-04-17 14:42   ` De Lara Guarch, Pablo

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=1522917349-19049-1-git-send-email-hemant.agrawal@nxp.com \
    --to=hemant.agrawal@nxp.com \
    --cc=akhil.goyal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=dpdk-up@NXP1.onmicrosoft.com \
    --cc=pablo.de.lara.guarch@intel.com \
    /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).