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 03AB6A00C3; Mon, 17 Jan 2022 15:04:46 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B43D9411E6; Mon, 17 Jan 2022 15:04:46 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 502E540141 for ; Mon, 17 Jan 2022 15:04:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642428285; x=1673964285; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=enQW09gtn7kierapSQuhvBSs5YRlO+j5jHUHd5aLoU4=; b=B4hz0aqRGGi5rgY3zsIOpqcutI0Ql1m+Jera+F5USyuGHp7oFrdmefN/ rq9gPMBynNcp4yrapdVtG2Ed/hCLi9BFAu3poAAlZYECXs0SIF11B1oXD Cd2DH2pwpZ8dYALNG0I2ZIN+GGK1kx+weRTgAT4mW8tUUpAmqExsN7/JX VYAU46W0bpYcdXcokKTUdIPvkyqNJCwU83Iru1JN9CTuloTSKVJgrqXjK ADJoqcYw/jr7ceuG1OhvLxqIjbNUabENYqqR7PnnEcZHxKVo5imSj+UJs ulUg0/ZDI5MccyxskmJ3jRIvil4z22c91nedoxDPUCqGyqwmqyY1F3xi+ w==; X-IronPort-AV: E=McAfee;i="6200,9189,10229"; a="244426395" X-IronPort-AV: E=Sophos;i="5.88,295,1635231600"; d="scan'208";a="244426395" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jan 2022 06:02:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,295,1635231600"; d="scan'208";a="476662857" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.27]) by orsmga006.jf.intel.com with ESMTP; 17 Jan 2022 06:02:36 -0800 From: Ferruh Yigit To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao Cc: dev@dpdk.org, Ferruh Yigit Subject: [PATCH] net/cnxk: fix dangling pointer in meter for gcc12 Date: Mon, 17 Jan 2022 14:02:26 +0000 Message-Id: <20220117140226.3019392-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Observed with: gcc (GCC) 12.0.0 20220116 (experimental) In file included from ../drivers/net/cnxk/cnxk_ethdev.h:16, from ../drivers/net/cnxk/cnxk_ethdev_mtr.c:5: In function ‘rte_mtr_error_set’, inlined from ‘cnxk_nix_mtr_policy_validate’ at ../drivers/net/cnxk/cnxk_ethdev_mtr.c:311:14: ../lib/ethdev/rte_mtr_driver.h:188:24: error: storing the address of local variable ‘message’ in ‘*error.message’ [-Werror=dangling-pointer=] 188 | *error = (struct rte_mtr_error){ | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ 189 | .type = type, | ~~~~~~~~~~~~~ 190 | .cause = cause, | ~~~~~~~~~~~~~~~ 191 | .message = message, | ~~~~~~~~~~~~~~~~~~~ 192 | }; | ~ ../drivers/net/cnxk/cnxk_ethdev_mtr.c: In function ‘cnxk_nix_mtr_policy_validate’: ../drivers/net/cnxk/cnxk_ethdev_mtr.c:288:14: note: ‘message’ declared here 288 | char message[1024]; | ^~~~~~~ ../drivers/net/cnxk/cnxk_ethdev_mtr.c:288:14: note: ‘error’ declared here It is a valid compiler warning, make local variable a global one. Signed-off-by: Ferruh Yigit --- Fix is done in a quickest way, mainly to report the issue, please feel free to suggest another solution for the build error. --- drivers/net/cnxk/cnxk_ethdev_mtr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/cnxk/cnxk_ethdev_mtr.c b/drivers/net/cnxk/cnxk_ethdev_mtr.c index 39d856382656..b6c6a6621935 100644 --- a/drivers/net/cnxk/cnxk_ethdev_mtr.c +++ b/drivers/net/cnxk/cnxk_ethdev_mtr.c @@ -285,7 +285,7 @@ cnxk_nix_mtr_policy_validate(struct rte_eth_dev *dev, static const char *const action_color[] = {"Green", "Yellow", "Red"}; bool supported[RTE_COLORS] = {false, false, false}; const struct rte_flow_action *action; - char message[1024]; + static char message[1024]; uint32_t i; RTE_SET_USED(dev); -- 2.34.1