baseband/acc100: avoid out-of-bounds access
authorNicolas Chautru <nicolas.chautru@intel.com>
Tue, 22 Feb 2022 23:43:36 +0000 (15:43 -0800)
committerAkhil Goyal <gakhil@marvell.com>
Wed, 23 Feb 2022 10:59:51 +0000 (11:59 +0100)
The actual maximum number of gather pointers should have been limited

Coverity issue: 375803, 375813, 375819, 375827, 375831
Fixes: 5ad5060f8f7a ("baseband/acc100: add LDPC processing functions")
Cc: stable@dpdk.org
Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
drivers/baseband/acc100/rte_acc100_pmd.c
drivers/baseband/acc100/rte_acc100_pmd.h

index f86474f..de7e4bc 100644 (file)
@@ -1460,8 +1460,7 @@ acc100_dma_fill_blk_type_in(struct acc100_dma_req_desc *desc,
        next_triplet++;
 
        while (cb_len > 0) {
-               if (next_triplet < ACC100_DMA_MAX_NUM_POINTERS &&
-                               m->next != NULL) {
+               if (next_triplet < ACC100_DMA_MAX_NUM_POINTERS_IN && m->next != NULL) {
 
                        m = m->next;
                        *seg_total_left = rte_pktmbuf_data_len(m);
index 03ed0b3..cbcece2 100644 (file)
 #define ACC100_SW_RING_MEM_ALLOC_ATTEMPTS 5
 #define ACC100_MAX_QUEUE_DEPTH            1024
 #define ACC100_DMA_MAX_NUM_POINTERS       14
+#define ACC100_DMA_MAX_NUM_POINTERS_IN    7
 #define ACC100_DMA_DESC_PADDING           8
 #define ACC100_FCW_PADDING                12
 #define ACC100_DESC_FCW_OFFSET            192