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 31B4CA0543; Thu, 15 Dec 2022 02:11:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BA42940684; Thu, 15 Dec 2022 02:11:46 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 26F42400D6 for ; Thu, 15 Dec 2022 02:11:44 +0100 (CET) Received: from kwepemm600004.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NXYx90sh2zqT3B; Thu, 15 Dec 2022 09:07:25 +0800 (CST) Received: from [10.67.103.231] (10.67.103.231) 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 09:11:42 +0800 Message-ID: Date: Thu, 15 Dec 2022 09:11:42 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH V5 5/8] mem: possible data truncation and conversion error To: =?UTF-8?Q?Morten_Br=c3=b8rup?= , CC: , , , , References: <20221208080540.62913-1-lihuisong@huawei.com> <20221214123253.29549-1-lihuisong@huawei.com> <20221214123253.29549-6-lihuisong@huawei.com> <98CBD80474FA8B44BF855DF32C47DC35D8759E@smartserver.smartshare.dk> From: "lihuisong (C)" In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35D8759E@smartserver.smartshare.dk> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.231] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) 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 在 2022/12/14 21:00, Morten Brørup 写道: >> From: Huisong Li [mailto:lihuisong@huawei.com] >> Sent: Wednesday, 14 December 2022 13.33 >> >> 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); > Consider: "Head id" -> "Heap_id" Need to do this in this patch? Maybe it's better to do this in a new patch. What do you think? > > >> 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 >>