crypto/dpaax_sec: fix a null pointer dereference after null check
diff mbox series

Message ID f1965d60316035dc1914b2a21b8ad238190f64da.1599301379.git.wangyunjian@huawei.com
State Accepted
Delegated to: akhil goyal
Headers show
Series
  • crypto/dpaax_sec: fix a null pointer dereference after null check
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

wangyunjian Sept. 5, 2020, 10:26 a.m. UTC
From: Yunjian Wang <wangyunjian@huawei.com>

This patch fixes a null pointer dereference after null check detected by
coverity scan.

Coverity issue: 349904
Fixes: 6a0c9d364afc ("crypto/dpaax_sec: support HFN override")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/crypto/dpaa_sec/dpaa_sec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Akhil Goyal Oct. 6, 2020, 8:37 p.m. UTC | #1
> 
> From: Yunjian Wang <wangyunjian@huawei.com>
> 
> This patch fixes a null pointer dereference after null check detected by
> coverity scan.
> 
> Coverity issue: 349904
> Fixes: 6a0c9d364afc ("crypto/dpaax_sec: support HFN override")
> Cc: stable@dpdk.org
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>

Applied to dpdk-next-crypto

Thanks.

Patch
diff mbox series

diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index c4339336d..fa42c9906 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -2949,7 +2949,8 @@  dpaa_sec_set_pdcp_session(struct rte_cryptodev *dev,
 	session->pdcp.hfn = pdcp_xform->hfn;
 	session->pdcp.hfn_threshold = pdcp_xform->hfn_threshold;
 	session->pdcp.hfn_ovd = pdcp_xform->hfn_ovrd;
-	session->pdcp.hfn_ovd_offset = cipher_xform->iv.offset;
+	if (cipher_xform)
+		session->pdcp.hfn_ovd_offset = cipher_xform->iv.offset;
 
 	rte_spinlock_lock(&dev_priv->lock);
 	for (i = 0; i < MAX_DPAA_CORES; i++) {