DPDK patches and discussions
 help / color / mirror / Atom feed
* mlx5:  unitialized warning
@ 2021-12-17 18:05 Stephen Hemminger
  2021-12-17 19:01 ` Dmitry Kozlyuk
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2021-12-17 18:05 UTC (permalink / raw)
  To: dev

Building current main branch with gcc (Debian 10.2.1-6) 10.2.1 20210110


[1843/3131] Compiling C object drivers/libtmp_rte_net_mlx5.a.p/net_mlx5_mlx5_flow_meter.c.o
../drivers/net/mlx5/mlx5_flow_meter.c: In function ‘mlx5_flow_meter_create’:
../drivers/net/mlx5/mlx5_flow_meter.c:1170:33: warning: ‘legacy_fm’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 1170 |  struct mlx5_legacy_flow_meter *legacy_fm;
      |                                 ^~~~~~~~~

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

* RE: mlx5:  unitialized warning
  2021-12-17 18:05 mlx5: unitialized warning Stephen Hemminger
@ 2021-12-17 19:01 ` Dmitry Kozlyuk
  2021-12-17 19:19   ` Stephen Hemminger
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Kozlyuk @ 2021-12-17 19:01 UTC (permalink / raw)
  To: Stephen Hemminger, dev

> Building current main branch with gcc (Debian 10.2.1-6) 10.2.1 20210110
> 
> 
> [1843/3131] Compiling C object
> drivers/libtmp_rte_net_mlx5.a.p/net_mlx5_mlx5_flow_meter.c.o
> ../drivers/net/mlx5/mlx5_flow_meter.c: In function
> ‘mlx5_flow_meter_create’:
> ../drivers/net/mlx5/mlx5_flow_meter.c:1170:33: warning: ‘legacy_fm’ may be
> used uninitialized in this function [-Wmaybe-uninitialized]
>  1170 |  struct mlx5_legacy_flow_meter *legacy_fm;
>       |                                 ^~~~~~~~~

Hi Stephen,

I don't see this warning with gcc 10.3.0 (Ubuntu 10.3.0-1ubuntu1~20.04).
Firstly, I believe it's a false positive:
legacy_fm is initialized and used only when priv->sh->meter_aso_en == false:

1237	if (priv->sh->meter_aso_en) {
		...
1245	} else {
    		legacy_fm = ...
		if (legacy_fm == NULL)
			return ...;
		...
	}
	...
1276	if (!priv->sh->meter_aso_en)
		TAILQ_INSERT_TAIL(fms, legacy_fm, next);

However, even if it's fixed in GCC between 10.2.1 and 10.3.0,
I've seen it with x86_64-w64-mingw32-gcc (GCC) 9.3-win32 20200320
while working on enabling drivers/*/mlx5 build with GCC,
so a workaround will probably still be needed.

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

* Re: mlx5:  unitialized warning
  2021-12-17 19:01 ` Dmitry Kozlyuk
@ 2021-12-17 19:19   ` Stephen Hemminger
  2021-12-17 19:28     ` Dmitry Kozlyuk
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2021-12-17 19:19 UTC (permalink / raw)
  To: Dmitry Kozlyuk; +Cc: dev

On Fri, 17 Dec 2021 19:01:31 +0000
Dmitry Kozlyuk <dkozlyuk@nvidia.com> wrote:

> > Building current main branch with gcc (Debian 10.2.1-6) 10.2.1 20210110
> > 
> > 
> > [1843/3131] Compiling C object
> > drivers/libtmp_rte_net_mlx5.a.p/net_mlx5_mlx5_flow_meter.c.o
> > ../drivers/net/mlx5/mlx5_flow_meter.c: In function
> > ‘mlx5_flow_meter_create’:
> > ../drivers/net/mlx5/mlx5_flow_meter.c:1170:33: warning: ‘legacy_fm’ may be
> > used uninitialized in this function [-Wmaybe-uninitialized]
> >  1170 |  struct mlx5_legacy_flow_meter *legacy_fm;
> >       |                                 ^~~~~~~~~  
> 
> Hi Stephen,
> 
> I don't see this warning with gcc 10.3.0 (Ubuntu 10.3.0-1ubuntu1~20.04).
> Firstly, I believe it's a false positive:
> legacy_fm is initialized and used only when priv->sh->meter_aso_en == false:
> 
> 1237	if (priv->sh->meter_aso_en) {
> 		...
> 1245	} else {
>     		legacy_fm = ...
> 		if (legacy_fm == NULL)
> 			return ...;
> 		...
> 	}
> 	...
> 1276	if (!priv->sh->meter_aso_en)
> 		TAILQ_INSERT_TAIL(fms, legacy_fm, next);
> 
> However, even if it's fixed in GCC between 10.2.1 and 10.3.0,
> I've seen it with x86_64-w64-mingw32-gcc (GCC) 9.3-win32 20200320
> while working on enabling drivers/*/mlx5 build with GCC,
> so a workaround will probably still be needed.

It maybe because I was testing with thread santizer enabled and compiler
was doing different optimizations.

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

* RE: mlx5:  unitialized warning
  2021-12-17 19:19   ` Stephen Hemminger
@ 2021-12-17 19:28     ` Dmitry Kozlyuk
  2021-12-17 20:17       ` Stephen Hemminger
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Kozlyuk @ 2021-12-17 19:28 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

> > I don't see this warning with gcc 10.3.0 (Ubuntu 10.3.0-1ubuntu1~20.04).
[...]
> 
> It maybe because I was testing with thread santizer enabled and compiler
> was doing different optimizations.

Reproduced with -Dc_args=-fsanitize=thread, thanks!

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

* Re: mlx5:  unitialized warning
  2021-12-17 19:28     ` Dmitry Kozlyuk
@ 2021-12-17 20:17       ` Stephen Hemminger
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2021-12-17 20:17 UTC (permalink / raw)
  To: Dmitry Kozlyuk; +Cc: dev

On Fri, 17 Dec 2021 19:28:26 +0000
Dmitry Kozlyuk <dkozlyuk@nvidia.com> wrote:

> > > I don't see this warning with gcc 10.3.0 (Ubuntu 10.3.0-1ubuntu1~20.04).  
> [...]
> > 
> > It maybe because I was testing with thread santizer enabled and compiler
> > was doing different optimizations.  
> 
> Reproduced with -Dc_args=-fsanitize=thread, thanks!

I was using
   -Db_sanitize=thread
which is the meson way to do it

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

end of thread, other threads:[~2021-12-17 20:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 18:05 mlx5: unitialized warning Stephen Hemminger
2021-12-17 19:01 ` Dmitry Kozlyuk
2021-12-17 19:19   ` Stephen Hemminger
2021-12-17 19:28     ` Dmitry Kozlyuk
2021-12-17 20:17       ` Stephen Hemminger

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