[PATCH v1 7/9] baseband/acc: fix potential arithmetic overflow Fix potential issue of overflow causing coverity warning.

Nicolas Chautru nicolas.chautru at intel.com
Thu Feb 9 23:19:27 CET 2023


Coverity issue: 383154
Fixes: 8e16839937 ("baseband/acc: extension of the device structure")
Cc: stable at dpdk.org

Signed-off-by: Nicolas Chautru <nicolas.chautru at intel.com>
---
 drivers/baseband/acc/rte_vrb_pmd.c | 2 +-
 drivers/baseband/acc/vrb_pmd.h     | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/baseband/acc/rte_vrb_pmd.c b/drivers/baseband/acc/rte_vrb_pmd.c
index 0bd5c65177..8fcb06b4ff 100644
--- a/drivers/baseband/acc/rte_vrb_pmd.c
+++ b/drivers/baseband/acc/rte_vrb_pmd.c
@@ -518,7 +518,7 @@ vrb_setup_queues(struct rte_bbdev *dev, uint16_t num_queues, int socket_id)
 	if (d->tail_ptrs == NULL)
 		d->tail_ptrs = rte_zmalloc_socket(
 				dev->device->driver->name,
-				d->num_qgroups * d->num_aqs * sizeof(uint32_t),
+				VRB_MAX_QGRPS * VRB_MAX_AQS * sizeof(uint32_t),
 				RTE_CACHE_LINE_SIZE, socket_id);
 	if (d->tail_ptrs == NULL) {
 		rte_bbdev_log(ERR, "Failed to allocate tail ptr for %s:%u",
diff --git a/drivers/baseband/acc/vrb_pmd.h b/drivers/baseband/acc/vrb_pmd.h
index f3c9239881..01028273e7 100644
--- a/drivers/baseband/acc/vrb_pmd.h
+++ b/drivers/baseband/acc/vrb_pmd.h
@@ -36,6 +36,7 @@
 
 #define VRB_NUM_ACCS                 6
 #define VRB_MAX_QGRPS                32
+#define VRB_MAX_AQS                  32
 
 #define ACC_STATUS_WAIT      10
 #define ACC_STATUS_TO        100
-- 
2.34.1



More information about the stable mailing list