From ecdcf5720497371f360dde918df83dbc56f32284 Mon Sep 17 00:00:00 2001
From: Huisong Li <lihuisong@huawei.com>
Date: Mon, 19 Dec 2022 15:06:45 +0800
Subject: mem: fix telemetry data truncation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[ upstream commit 6243e36b837b754c33017718cf79f7574a52b09c ]

The 'u32' and 'u64' data can not assigned to 'int' type variable.
They need to use the 'u64' APIs to add.

Fixes: e6732d0d6e26 ("mem: add telemetry infos")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/eal/common/eal_common_memory.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/eal/common/eal_common_memory.c b/lib/eal/common/eal_common_memory.c
index 69dea8f72b..f2f8858e22 100644
--- a/lib/eal/common/eal_common_memory.c
+++ b/lib/eal/common/eal_common_memory.c
@@ -1191,7 +1191,7 @@ handle_eal_heap_info_request(const char *cmd __rte_unused, const char *params,
 	malloc_heap_get_stats(heap, &sock_stats);
 
 	rte_tel_data_start_dict(d);
-	rte_tel_data_add_dict_int(d, "Head id", heap_id);
+	rte_tel_data_add_dict_u64(d, "Head id", heap_id);
 	rte_tel_data_add_dict_string(d, "Name", heap->name);
 	rte_tel_data_add_dict_u64(d, "Heap_size",
 				  sock_stats.heap_totalsz_bytes);
@@ -1253,13 +1253,13 @@ handle_eal_memzone_info_request(const char *cmd __rte_unused,
 	mz = rte_fbarray_get(&mcfg->memzones, mz_idx);
 
 	rte_tel_data_start_dict(d);
-	rte_tel_data_add_dict_int(d, "Zone", mz_idx);
+	rte_tel_data_add_dict_u64(d, "Zone", mz_idx);
 	rte_tel_data_add_dict_string(d, "Name", mz->name);
-	rte_tel_data_add_dict_int(d, "Length", mz->len);
+	rte_tel_data_add_dict_u64(d, "Length", mz->len);
 	snprintf(addr, ADDR_STR, "%p", mz->addr);
 	rte_tel_data_add_dict_string(d, "Address", addr);
 	rte_tel_data_add_dict_int(d, "Socket", mz->socket_id);
-	rte_tel_data_add_dict_int(d, "Flags", mz->flags);
+	rte_tel_data_add_dict_u64(d, "Flags", mz->flags);
 
 	/* go through each page occupied by this memzone */
 	msl = rte_mem_virt2memseg_list(mz->addr);
@@ -1274,7 +1274,7 @@ handle_eal_memzone_info_request(const char *cmd __rte_unused,
 	ms_idx = RTE_PTR_DIFF(mz->addr, msl->base_va) / page_sz;
 	ms = rte_fbarray_get(&msl->memseg_arr, ms_idx);
 
-	rte_tel_data_add_dict_int(d, "Hugepage_size", page_sz);
+	rte_tel_data_add_dict_u64(d, "Hugepage_size", page_sz);
 	snprintf(addr, ADDR_STR, "%p", ms->addr);
 	rte_tel_data_add_dict_string(d, "Hugepage_base", addr);
 
-- 
2.23.0

