[PATCH 08/11] crypto/dpaa2_sec: add a check on nb desc

Gagandeep Singh g.singh at nxp.com
Wed Jul 3 12:26:46 CEST 2024


This patch add preventive check for the validity of nb descriptors

Signed-off-by: Gagandeep Singh <g.singh at nxp.com>
---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 4f80cfea5e..88cca1b429 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -2015,6 +2015,13 @@ dpaa2_sec_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		return 0;
 	}
 
+	if (qp_conf->nb_descriptors < (2 * FLE_POOL_CACHE_SIZE)) {
+		DPAA2_SEC_ERR("Minimum supported nb_descriptors %d,"
+			      " but given %d\n", (2 * FLE_POOL_CACHE_SIZE),
+			      qp_conf->nb_descriptors);
+		return -EINVAL;
+	}
+
 	DPAA2_SEC_DEBUG("dev =%p, queue =%d, conf =%p",
 		    dev, qp_id, qp_conf);
 
-- 
2.25.1



More information about the dev mailing list