[v2] pipeline: fix table stats

Message ID 1627882332-332683-1-git-send-email-churchill.khangar@intel.com (mailing list archive)
State Accepted, archived
Headers
Series [v2] pipeline: fix table stats |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-intel-Functional success Functional Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

Churchill Khangar Aug. 2, 2021, 5:32 a.m. UTC
  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(-)
  

Comments

Thomas Monjalon Aug. 4, 2021, 12:45 p.m. UTC | #1
02/08/2021 07:32, Churchill Khangar:
> 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>

Applied, thanks.
  

Patch

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];