From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id D79D0A0C4D
	for <public@inbox.dpdk.org>; Mon,  2 Aug 2021 15:11:13 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id C732641165;
	Mon,  2 Aug 2021 15:11:13 +0200 (CEST)
Received: from mga03.intel.com (mga03.intel.com [134.134.136.65])
 by mails.dpdk.org (Postfix) with ESMTP id E2A9F40140;
 Mon,  2 Aug 2021 15:11:10 +0200 (CEST)
X-IronPort-AV: E=McAfee;i="6200,9189,10063"; a="213485660"
X-IronPort-AV: E=Sophos;i="5.84,289,1620716400"; d="scan'208";a="213485660"
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
 by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 02 Aug 2021 06:06:45 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.84,288,1620716400"; d="scan'208";a="583957266"
Received: from ena-1.iind.intel.com ([10.190.200.140])
 by fmsmga001.fm.intel.com with ESMTP; 02 Aug 2021 06:06:43 -0700
From: Churchill Khangar <churchill.khangar@intel.com>
To: dev@dpdk.org
Cc: cristian.dumitrescu@intel.com, churchill.khangar@intel.com,
 yogesh.jangra@intel.com, venkata.suresh.kumar.p@intel.com, stable@dpdk.org
Date: Mon,  2 Aug 2021 11:02:12 +0530
Message-Id: <1627882332-332683-1-git-send-email-churchill.khangar@intel.com>
X-Mailer: git-send-email 1.8.3.1
In-Reply-To: <1627878914-246973-1-git-send-email-churchill.khangar@intel.com>
References: <1627878914-246973-1-git-send-email-churchill.khangar@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Subject: [dpdk-stable] [PATCH] [v2] pipeline: fix table stats
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

This patch fixes the memcpy function call which was incorrect and led
to memory corruption for tables with more that just a few actions.

Fixes: 742b0a57f50e4 ("pipeline: add table statistics to SWX")
Cc: stable@dpdk.org

Signed-off-by: Churchill Khangar <churchill.khangar@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/pipeline/rte_swx_pipeline.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c
index 84505e2..8eb978a 100644
--- a/lib/pipeline/rte_swx_pipeline.c
+++ b/lib/pipeline/rte_swx_pipeline.c
@@ -10940,8 +10940,8 @@ struct meter_profile meter_profile_default = {
 
 	table_stats = &p->table_stats[table->id];
 
-	memcpy(&stats->n_pkts_action,
-	       &table_stats->n_pkts_action,
+	memcpy(stats->n_pkts_action,
+	       table_stats->n_pkts_action,
 	       p->n_actions * sizeof(uint64_t));
 
 	stats->n_pkts_hit = table_stats->n_pkts_hit[1];
-- 
1.8.3.1