From patchwork Wed Dec 28 15:10:19 2022 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: 121453 X-Patchwork-Delegate: david.marchand@redhat.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 81BE8A04FD; Wed, 28 Dec 2022 16:10:44 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7B13942D29; Wed, 28 Dec 2022 16:10:30 +0100 (CET) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id 49EFB42D1E for ; Wed, 28 Dec 2022 16:10:26 +0100 (CET) Received: from dkrd2.smartsharesys.local ([192.168.4.12]) by smartserver.smartsharesystems.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 28 Dec 2022 16:10:25 +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?= Subject: [PATCH v5 4/4] net/mlx5: fix warning about rte_memcpy length Date: Wed, 28 Dec 2022 16:10:19 +0100 Message-Id: <20221228151019.101309-4-mb@smartsharesystems.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221228151019.101309-1-mb@smartsharesystems.com> References: <20221202153432.131023-1-mb@smartsharesystems.com> <20221228151019.101309-1-mb@smartsharesystems.com> MIME-Version: 1.0 X-OriginalArrivalTime: 28 Dec 2022 15:10:26.0112 (UTC) FILETIME=[83CF3400:01D91ACE] 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. Signed-off-by: Morten Brørup 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)