diff mbox series

[v3,4/4] baseband/acc100: add protection for some negative scenario

Message ID 1652734113-124047-5-git-send-email-nicolas.chautru@intel.com (mailing list archive)
State Superseded
Delegated to: akhil goyal
Headers show
Series drivers/baseband: PMD to support ACC101 device | expand

Checks

Context Check Description
ci/intel-Testing success Testing PASS
ci/Intel-compilation fail Compilation issues
ci/checkpatch success coding style OK

Commit Message

Chautru, Nicolas May 16, 2022, 8:48 p.m. UTC
Catch exception in PMD in case of invalid input parameter.

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
---
 drivers/baseband/acc100/rte_acc100_pmd.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index b03cedc..b59c9d7 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -1237,6 +1237,8 @@ 
 			return (bg == 1 ? ACC100_K0_3_1 : ACC100_K0_3_2) * z_c;
 	}
 	/* LBRM case - includes a division by N */
+	if (unlikely(z_c == 0))
+		return 0;
 	if (rv_index == 1)
 		return (((bg == 1 ? ACC100_K0_1_1 : ACC100_K0_1_2) * n_cb)
 				/ n) * z_c;
@@ -1912,6 +1914,10 @@  static inline uint32_t hq_index(uint32_t offset)
 
 	/* Soft output */
 	if (check_bit(op->turbo_dec.op_flags, RTE_BBDEV_TURBO_SOFT_OUTPUT)) {
+		if (op->turbo_dec.soft_output.data == 0) {
+			rte_bbdev_log(ERR, "Soft output is not defined");
+			return -1;
+		}
 		if (check_bit(op->turbo_dec.op_flags,
 				RTE_BBDEV_TURBO_EQUALIZER))
 			*s_out_length = e;