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 9919BA0540; Mon, 12 Dec 2022 07:43:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5AA5842D2F; Mon, 12 Dec 2022 07:43:10 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 5E00940684 for ; Mon, 12 Dec 2022 07:43:05 +0100 (CET) Received: from kwepemm600004.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NVsVp6dQdzJqTH; Mon, 12 Dec 2022 14:42:10 +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; Mon, 12 Dec 2022 14:43:03 +0800 From: Huisong Li To: CC: , , , , , , Subject: [PATCH V3 05/11] mempool: fix possible data truncation and conversion error Date: Mon, 12 Dec 2022 14:43:00 +0800 Message-ID: <20221212064306.39232-6-lihuisong@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20221212064306.39232-1-lihuisong@huawei.com> References: <20221208080540.62913-1-lihuisong@huawei.com> <20221212064306.39232-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: dggems706-chm.china.huawei.com (10.3.19.183) 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. The 'u32' data need to use the 'u32' telemetry API to add, and the 'u64' data need to use the 'u64' telemetry API to add. Fixes: 2f5c4025abb3 ("mempool: add telemetry endpoint") Cc: stable@dpdk.org Signed-off-by: Huisong Li Acked-by: Morten Brørup Acked-by: Chengwen Feng --- lib/mempool/rte_mempool.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c index f33f455790..c665fa5e14 100644 --- a/lib/mempool/rte_mempool.c +++ b/lib/mempool/rte_mempool.c @@ -1500,27 +1500,27 @@ mempool_info_cb(struct rte_mempool *mp, void *arg) return; rte_tel_data_add_dict_string(info->d, "name", mp->name); - rte_tel_data_add_dict_int(info->d, "pool_id", mp->pool_id); - rte_tel_data_add_dict_int(info->d, "flags", mp->flags); + rte_tel_data_add_dict_u64(info->d, "pool_id", mp->pool_id); + rte_tel_data_add_dict_u32(info->d, "flags", mp->flags); rte_tel_data_add_dict_int(info->d, "socket_id", mp->socket_id); - rte_tel_data_add_dict_int(info->d, "size", mp->size); - rte_tel_data_add_dict_int(info->d, "cache_size", mp->cache_size); - rte_tel_data_add_dict_int(info->d, "elt_size", mp->elt_size); - rte_tel_data_add_dict_int(info->d, "header_size", mp->header_size); - rte_tel_data_add_dict_int(info->d, "trailer_size", mp->trailer_size); - rte_tel_data_add_dict_int(info->d, "private_data_size", + rte_tel_data_add_dict_u32(info->d, "size", mp->size); + rte_tel_data_add_dict_u32(info->d, "cache_size", mp->cache_size); + rte_tel_data_add_dict_u32(info->d, "elt_size", mp->elt_size); + rte_tel_data_add_dict_u32(info->d, "header_size", mp->header_size); + rte_tel_data_add_dict_u32(info->d, "trailer_size", mp->trailer_size); + rte_tel_data_add_dict_u32(info->d, "private_data_size", mp->private_data_size); rte_tel_data_add_dict_int(info->d, "ops_index", mp->ops_index); - rte_tel_data_add_dict_int(info->d, "populated_size", + rte_tel_data_add_dict_u32(info->d, "populated_size", mp->populated_size); mz = mp->mz; rte_tel_data_add_dict_string(info->d, "mz_name", mz->name); - rte_tel_data_add_dict_int(info->d, "mz_len", mz->len); - rte_tel_data_add_dict_int(info->d, "mz_hugepage_sz", + rte_tel_data_add_dict_u64(info->d, "mz_len", mz->len); + rte_tel_data_add_dict_u64(info->d, "mz_hugepage_sz", mz->hugepage_sz); rte_tel_data_add_dict_int(info->d, "mz_socket_id", mz->socket_id); - rte_tel_data_add_dict_int(info->d, "mz_flags", mz->flags); + rte_tel_data_add_dict_u32(info->d, "mz_flags", mz->flags); } static int -- 2.33.0