DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/cnxk: fix dangling pointer in meter for gcc12
@ 2022-01-17 14:02 Ferruh Yigit
  2022-02-23  9:49 ` [PATCH] net/cnxk: fix compilation issue " Rakesh Kudurumalla
  2022-02-23  9:55 ` Rakesh Kudurumalla
  0 siblings, 2 replies; 5+ messages in thread
From: Ferruh Yigit @ 2022-01-17 14:02 UTC (permalink / raw)
  To: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao
  Cc: dev, Ferruh Yigit

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-23 17:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17 14:02 [PATCH] net/cnxk: fix dangling pointer in meter for gcc12 Ferruh Yigit
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

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).