From patchwork Wed Nov 9 05:01:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liu, Mingxia" X-Patchwork-Id: 119589 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3C6F0A0093; Wed, 9 Nov 2022 06:55:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 290BE400D7; Wed, 9 Nov 2022 06:55:02 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 2D07F400D4; Wed, 9 Nov 2022 06:54:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667973300; x=1699509300; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=BfirQqPNF8X7xT+5gnrXgEBciMyBmpqvXMTiFzguUhw=; b=Rr9jhTTfEa8z3+ft3kG22FKYGMVURHO8eOGmtvG3w8opiWWlXvQH+s2I upPl0UtZiYtni/grfm5M9X22+BHfewhzYFG31xhg7UEqZevDCIbXxvqjB Q/CTXTjaYJnZG06EwvMWMQ7Fa1+5+Hw69GjV6wo++zd1AxNRaK0XzwruO yKTreau5mJ+OsVAqm9Ox2EPut5Edh47wLaBVXa4jPdLkNNW7IScvIgbPn /klT6EA185fRR3NqtP17shVdSYMrLt3J/svkEDtSo5uK+L0GRVh/LIFcy g6RWATOyI13YCovMBOZhaqvju25ANJM6Zw6CYTWaL9gj36ko/i87m2Vbg Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10525"; a="375172650" X-IronPort-AV: E=Sophos;i="5.96,149,1665471600"; d="scan'208";a="375172650" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2022 21:54:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10525"; a="881798685" X-IronPort-AV: E=Sophos;i="5.96,149,1665471600"; d="scan'208";a="881798685" Received: from dpdk-mingxial-01.sh.intel.com ([10.67.119.112]) by fmsmga006.fm.intel.com with ESMTP; 08 Nov 2022 21:54:57 -0800 From: Mingxia Liu To: dev@dpdk.org Cc: jingjing.wu@intel.com, beilei.xing@intel.com, xiao.w.wang@intel.com, junfeng.guo@intel.com, mingxial , stable@dpdk.org Subject: [PATCH v1] common/idpf: fix tainted scalar Date: Wed, 9 Nov 2022 05:01:30 +0000 Message-Id: <20221109050130.392235-1-mingxia.liu@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: mingxial 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") Cc: stable@dpdk.org Signed-off-by: mingxial Acked-by: Qi Zhang --- drivers/common/idpf/base/idpf_common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/common/idpf/base/idpf_common.c b/drivers/common/idpf/base/idpf_common.c index 1debf129a3..bcc0c11ae8 100644 --- a/drivers/common/idpf/base/idpf_common.c +++ b/drivers/common/idpf/base/idpf_common.c @@ -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;