]> git.droids-corp.org - dpdk.git/commitdiff
baseband/acc100: add protection for some negative scenario
authorNicolas Chautru <nicolas.chautru@intel.com>
Tue, 31 May 2022 22:31:43 +0000 (15:31 -0700)
committerAkhil Goyal <gakhil@marvell.com>
Tue, 21 Jun 2022 18:04:49 +0000 (20:04 +0200)
Catch exception in PMD in case of invalid input parameter.

Fixes: 5ad5060f8f7a ("baseband/acc100: add LDPC processing functions")
Cc: stable@dpdk.org
Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/baseband/acc100/rte_acc100_pmd.c

index 79bee4345d08a7fccdd3aab0e4716c315b2dc785..32c8bc2b341b4fa2ea2e519999b67c9590ca902f 100644 (file)
@@ -1236,6 +1236,8 @@ get_k0(uint16_t n_cb, uint16_t z_c, uint8_t bg, uint8_t rv_index)
                        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;
@@ -1764,6 +1766,10 @@ acc100_dma_desc_td_fill(struct rte_bbdev_dec_op *op,
 
        /* 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;