From patchwork Fri May 15 11:44:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 70331 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6B693A00C3; Fri, 15 May 2020 13:45:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 42A5E1DAD2; Fri, 15 May 2020 13:45:05 +0200 (CEST) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id 3EE2B1DAC0 for ; Fri, 15 May 2020 13:45:04 +0200 (CEST) From: Bing Zhao To: viacheslavo@mellanox.com, rasland@mellanox.com Cc: orika@mellanox.com, matan@mellanox.com, dev@dpdk.org, suanmingm@mellanox.com Date: Fri, 15 May 2020 19:44:44 +0800 Message-Id: <1589543084-113804-2-git-send-email-bingz@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1589543084-113804-1-git-send-email-bingz@mellanox.com> References: <1589543084-113804-1-git-send-email-bingz@mellanox.com> Subject: [dpdk-dev] [PATCH 2/2] net/mlx5: fix port action resource initialization X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" After memory optimization, the organization of some resources are changed from pointer based LIST to the index based ILIST. A lot of code parts are touched due to such change. Some static code checking and analysis tool will complain and raise a false warning on the uninitialized value using. E.g. in the port action registering function, the stack variable will be used as the right value with some uninitialized field to initialize variable allocated from heap. But indeed, it is not an error because all the fileds set with the uninitialized value will be overwritten in the following code part and the macros. All the fields will be used as the left value explicitly. It makes no sense to clear the stack variable to 0 in this case, and the extra memset will introduce some cycles overhead. It just needs to ignore the false warning from the tool, if any. Fixes: f3faf9e ("net/mlx5: convert port id action to indexed") Cc: suanmingm@mellanox.com Signed-off-by: Bing Zhao Reviewed-by: Matan Azrad Reviewed-by: Suanming Mou Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_dv.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 45fa60c..7fe4438 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -7832,7 +7832,6 @@ struct field_modify_info modify_tcp[] = { if (flow_dv_translate_action_port_id(dev, action, &port_id, error)) return -rte_errno; - memset(&port_id_resource, 0, sizeof(port_id_resource)); port_id_resource.port_id = port_id; MLX5_ASSERT(!handle->rix_port_id_action); if (flow_dv_port_id_action_resource_register