[PATCH 08/11] net/bnxt: address coverity overflow issues

Ajit Khaparde ajit.khaparde at broadcom.com
Wed Feb 5 18:20:01 CET 2025


From: Peter Spreadborough <peter.spreadborough at broadcom.com>

This change addresses the CID 449058: Integer handling issues
(OVERFLOW_BEFORE_WIDEN) reported by coverity.

Coverity issue: 449058
Signed-off-by: Peter Spreadborough <peter.spreadborough at broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
---
 drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c b/drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c
index 1770069295..c29933b803 100644
--- a/drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c
+++ b/drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c
@@ -468,7 +468,7 @@ static int alloc_link_pbl(struct tfc_ts_mem_cfg *mem_cfg, uint32_t page_size,
 	 * and page tables. The allocation will occur once only per backing
 	 * store and will located by name and reused on subsequent runs.
 	 */
-	total_size = page_size * total_pages;
+	total_size = (uint64_t)page_size * (uint64_t)total_pages;
 
 	if (total_size <= (1024 * 256))
 		mz_size = RTE_MEMZONE_256KB;
-- 
2.39.5 (Apple Git-154)



More information about the dev mailing list