crypto/dpaa_sec: fix a null pointer dereference
authorYunjian Wang <wangyunjian@huawei.com>
Sat, 5 Sep 2020 10:26:02 +0000 (18:26 +0800)
committerAkhil Goyal <akhil.goyal@nxp.com>
Wed, 14 Oct 2020 19:30:10 +0000 (21:30 +0200)
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>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
drivers/crypto/dpaa_sec/dpaa_sec.c

index 9700217..0495422 100644 (file)
@@ -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++) {