From patchwork Mon Jan 16 13:07:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Morten_Br=C3=B8rup?= X-Patchwork-Id: 122100 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A1BEB423F0; Mon, 16 Jan 2023 14:07:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AA73B42D1F; Mon, 16 Jan 2023 14:07:29 +0100 (CET) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id D976540691 for ; Mon, 16 Jan 2023 14:07:26 +0100 (CET) Received: from dkrd2.smartsharesys.local ([192.168.4.12]) by smartserver.smartsharesystems.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 16 Jan 2023 14:07:26 +0100 From: =?utf-8?q?Morten_Br=C3=B8rup?= To: dev@dpdk.org, roretzla@linux.microsoft.com, rmody@marvell.com, timothy.mcdaniel@intel.com, matan@nvidia.com, viacheslavo@nvidia.com Cc: ruifeng.wang@arm.com, zhoumin@loongson.cn, drc@linux.vnet.ibm.com, kda@semihalf.com, bruce.richardson@intel.com, konstantin.v.ananyev@yandex.ru, =?utf-8?q?Morten_Br=C3=B8rup?= , xuemingl@nvidia.com Subject: [PATCH v7 3/4] net/mlx5: fix warning about rte_memcpy length Date: Mon, 16 Jan 2023 14:07:23 +0100 Message-Id: <20230116130724.50277-3-mb@smartsharesystems.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230116130724.50277-1-mb@smartsharesystems.com> References: <20221202153432.131023-1-mb@smartsharesystems.com> <20230116130724.50277-1-mb@smartsharesystems.com> MIME-Version: 1.0 X-OriginalArrivalTime: 16 Jan 2023 13:07:26.0537 (UTC) FILETIME=[7B16AB90:01D929AB] 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 Use RTE_PTR_ADD where copying to the offset of a field in a structure holding multiple fields, to avoid compiler warnings with decorated rte_memcpy. Fixes: 16a7dbc4f69006cc1c96ca2a2c6d3e3c51a2ff50 ("net/mlx5: make flow modify action list thread safe") Cc: xuemingl@nvidia.com Cc: matan@nvidia.com Cc: viacheslavo@nvidia.com Signed-off-by: Morten Brørup Acked-by: Viacheslav Ovsiienko --- v7: * No changes. v6: * Add Fixes to patch description. v5: * First patch in series. --- drivers/net/mlx5/mlx5_flow_dv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 62c38b87a1..dd9f5fda1a 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -5662,7 +5662,7 @@ flow_dv_modify_create_cb(void *tool_ctx, void *cb_ctx) "cannot allocate resource memory"); return NULL; } - rte_memcpy(&entry->ft_type, + rte_memcpy(RTE_PTR_ADD(entry, offsetof(typeof(*entry), ft_type)), RTE_PTR_ADD(ref, offsetof(typeof(*ref), ft_type)), key_len + data_len); if (entry->ft_type == MLX5DV_FLOW_TABLE_TYPE_FDB)