[v1] baseband/acc100: avoid out-of-bounds access corner cases

Message ID 1645573416-165364-1-git-send-email-nicolas.chautru@intel.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series [v1] baseband/acc100: avoid out-of-bounds access corner cases |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

Chautru, Nicolas Feb. 22, 2022, 11:43 p.m. UTC
  Coverity issue: 375803, 375813, 375819, 375827, 375831
The actual maximum number of gather pointers should have been limited
Fixes: 5ad5060f8f7a ("baseband/acc100: add LDPC processing functions")

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
---
 drivers/baseband/acc100/rte_acc100_pmd.c | 3 +--
 drivers/baseband/acc100/rte_acc100_pmd.h | 1 +
 2 files changed, 2 insertions(+), 2 deletions(-)
  

Comments

Akhil Goyal Feb. 23, 2022, 11:01 a.m. UTC | #1
> Coverity issue: 375803, 375813, 375819, 375827, 375831
> The actual maximum number of gather pointers should have been limited
> Fixes: 5ad5060f8f7a ("baseband/acc100: add LDPC processing functions")
> 
> Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Cc: stable@dpdk.org
Applied to dpdk-next-crypto

Thanks
  

Patch

diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index 1c6080f..cc69c76 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -1460,8 +1460,7 @@ 
 	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);
diff --git a/drivers/baseband/acc100/rte_acc100_pmd.h b/drivers/baseband/acc100/rte_acc100_pmd.h
index 03ed0b3..cbcece2 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.h
+++ b/drivers/baseband/acc100/rte_acc100_pmd.h
@@ -113,6 +113,7 @@ 
 #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