From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Nithin Dabilpuram <ndabilpuram@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Sunil Kumar Kori <skori@marvell.com>,
Satha Rao <skoteshwar@marvell.com>
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>
Subject: [PATCH] net/cnxk: fix dangling pointer in meter for gcc12
Date: Mon, 17 Jan 2022 14:02:26 +0000 [thread overview]
Message-ID: <20220117140226.3019392-1-ferruh.yigit@intel.com> (raw)
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 <ferruh.yigit@intel.com>
---
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
next reply other threads:[~2022-01-17 14:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-17 14:02 Ferruh Yigit [this message]
2022-02-23 9:49 ` [PATCH] net/cnxk: fix compilation issue " Rakesh Kudurumalla
2022-02-23 11:41 ` Jerin Jacob
2022-02-23 17:13 ` Jerin Jacob
2022-02-23 9:55 ` Rakesh Kudurumalla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220117140226.3019392-1-ferruh.yigit@intel.com \
--to=ferruh.yigit@intel.com \
--cc=dev@dpdk.org \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=skori@marvell.com \
--cc=skoteshwar@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).