From: Anoob Joseph <ano...@marvell.com>

Coverity issue: 381022
Fixes: d94414d1627f ("crypto/cnxk: separate out PDCP cipher datapath")

Signed-off-by: Anoob Joseph <ano...@marvell.com>
---
 drivers/crypto/cnxk/cnxk_se.h | 38 ++++++++++++++---------------------
 1 file changed, 15 insertions(+), 23 deletions(-)

diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h
index 4675512bbc..47516592a3 100644
--- a/drivers/crypto/cnxk/cnxk_se.h
+++ b/drivers/crypto/cnxk/cnxk_se.h
@@ -2675,6 +2675,8 @@ fill_pdcp_params(struct rte_crypto_op *cop, struct 
cnxk_se_sess *sess,
                fc_params.dst_iov = fc_params.src_iov = (void *)src;
                prepare_iov_from_pkt_inplace(m_src, &fc_params, &flags);
        } else {
+               uint32_t pkt_len;
+
                /* Out of place processing */
                fc_params.src_iov = (void *)src;
                fc_params.dst_iov = (void *)dst;
@@ -2686,33 +2688,23 @@ fill_pdcp_params(struct rte_crypto_op *cop, struct 
cnxk_se_sess *sess,
                        goto err_exit;
                }
 
-               if (unlikely(m_dst != NULL)) {
-                       uint32_t pkt_len;
-
-                       /* Try to make room as much as src has */
-                       pkt_len = rte_pktmbuf_pkt_len(m_dst);
-
-                       if (unlikely(pkt_len < rte_pktmbuf_pkt_len(m_src))) {
-                               pkt_len = rte_pktmbuf_pkt_len(m_src) - pkt_len;
-                               if (!rte_pktmbuf_append(m_dst, pkt_len)) {
-                                       plt_dp_err("Not enough space in "
-                                                  "m_dst %p, need %u"
-                                                  " more",
-                                                  m_dst, pkt_len);
-                                       ret = -EINVAL;
-                                       goto err_exit;
-                               }
-                       }
+               /* Try to make room as much as src has */
+               pkt_len = rte_pktmbuf_pkt_len(m_dst);
 
-                       if (prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0)) {
-                               plt_dp_err("Prepare dst iov failed for "
-                                          "m_dst %p",
-                                          m_dst);
+               if (unlikely(pkt_len < rte_pktmbuf_pkt_len(m_src))) {
+                       pkt_len = rte_pktmbuf_pkt_len(m_src) - pkt_len;
+                       if (unlikely(rte_pktmbuf_append(m_dst, pkt_len) == 
NULL)) {
+                               plt_dp_err("Not enough space in m_dst %p, need 
%u more", m_dst,
+                                          pkt_len);
                                ret = -EINVAL;
                                goto err_exit;
                        }
-               } else {
-                       fc_params.dst_iov = (void *)src;
+               }
+
+               if (unlikely(prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 
0))) {
+                       plt_dp_err("Prepare dst iov failed for m_dst %p", 
m_dst);
+                       ret = -EINVAL;
+                       goto err_exit;
                }
        }
 
-- 
2.25.1

Reply via email to