From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1AE63A0543; Thu, 15 Dec 2022 11:32:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C109642D29; Thu, 15 Dec 2022 11:31:52 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id D939F40685 for ; Thu, 15 Dec 2022 11:31:46 +0100 (CET) Received: from kwepemm600004.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NXpMM2LWtzgZ2K; Thu, 15 Dec 2022 18:27:27 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 15 Dec 2022 18:31:45 +0800 From: Huisong Li To: CC: , , , , , , Subject: [PATCH V6 5/8] mem: possible data truncation and conversion error Date: Thu, 15 Dec 2022 18:31:43 +0800 Message-ID: <20221215103146.816-6-lihuisong@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20221215103146.816-1-lihuisong@huawei.com> References: <20221208080540.62913-1-lihuisong@huawei.com> <20221215103146.816-1-lihuisong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600004.china.huawei.com (7.193.23.242) X-CFilter-Loop: Reflected 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 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 Acked-by: Morten Brørup Acked-by: Chengwen Feng --- 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 688dc615d7..8e427bf4b4 100644 --- a/lib/eal/common/eal_common_memory.c +++ b/lib/eal/common/eal_common_memory.c @@ -1139,7 +1139,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); @@ -1201,13 +1201,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); @@ -1222,7 +1222,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.33.0