Skip to contentSkip to conversation

common/idpf: fix tainted scalar

PATCH Applied Mingxia Liu 2 participants 2 messages Nov 9, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/idpf: fix tainted scalar

From: mingxial <[email protected]>

Passing tainted expression "msg.data_len" to
"rte_memcpy", which uses it as a loop boundary.

Replace tainted expression with a temp variable
to avoid the tainted scalar coverity warning.

Coverity issue: 381688

Fixes fb4ac04e9bfa ("common/idpf: introduce common library")
---
 drivers/common/idpf/base/idpf_common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/common/idpf/base/idpf_common.c +3 -1
index 1debf129a3..bcc0c11ae8 100644
@@ -221,6 +221,7 @@ int idpf_clean_arq_element(struct idpf_hw *hw,
 {
 	struct idpf_ctlq_msg msg = { 0 };
 	int status;
+	u16 msg_data_len;
 
 	*pending = 1;
 
@@ -234,7 +235,8 @@ int idpf_clean_arq_element(struct idpf_hw *hw,
 	e->desc.datalen = msg.data_len;
 	if (msg.data_len > 0) {
 		e->buf_len = msg.data_len;
-		idpf_memcpy(e->msg_buf, msg.ctx.indirect.payload->va, msg.data_len,
+		msg_data_len = msg.data_len;
+		idpf_memcpy(e->msg_buf, msg.ctx.indirect.payload->va, msg_data_len,
 			    IDPF_DMA_TO_NONDMA);
 	}
 	return status;
Signature · 1 line
2.25.1
Acked-by on v1 1/1 Applied
#1 lore raw
Quoted 17 lines

-----Original Message-----
From: Mingxia Liu <[email protected]>
Sent: Wednesday, November 9, 2022 1:02 PM
To: [email protected]
Cc: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Wang, Xiao W <[email protected]>; Guo, Junfeng <[email protected]>; Liu, Mingxia <[email protected]>; [email protected]
Subject: [PATCH v1] common/idpf: fix tainted scalar

From: mingxial <[email protected]>

Passing tainted expression "msg.data_len" to "rte_memcpy", which uses it as a loop boundary.

Quoted 8 lines

Replace tainted expression with a temp variable to avoid the tainted scalar coverity warning.

Coverity issue: 381688

Fixes fb4ac04e9bfa ("common/idpf: introduce common library")

Applied to dpdk-next-net-intel.

Thanks
Qi