Skip to contentSkip to conversation

Compile-time warnings on mlx4/net-next

DISCUSSION Marcelo Ricardo Leitner 4 participants 5 messages Jan 15, 2015 – Jan 16, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi Or,

Building net-next.git from today, 4e7a84b1a5bc8094522fd11f628b00c4b4e78b4d, I'm seeing these warnings on mlx4:

drivers/net/ethernet/mellanox/mlx4/fw.c: In function ‘mlx4_config_dev_retrieval’:
drivers/net/ethernet/mellanox/mlx4/fw.c:2136:12: warning: ‘config_dev.rx_checksum_val’ may be used uninitialized in this function [-Wmaybe-uninitialized]
csum_mask = (config_dev.rx_checksum_val >> CONFIG_DEV_RX_CSUM_MODE_PORT2_BIT_OFFSET) &

            ^
In file included from include/linux/swab.h:4:0,
                 from include/uapi/linux/byteorder/little_endian.h:12,
                 from include/linux/byteorder/little_endian.h:4,
                 from ./arch/x86/include/uapi/asm/byteorder.h:4,
                 from include/asm-generic/bitops/le.h:5,
                 from ./arch/x86/include/asm/bitops.h:504,
                 from include/linux/bitops.h:36,
                 from include/linux/kernel.h:10,
                 from include/linux/skbuff.h:17,
                 from include/linux/if_ether.h:23,
                 from include/linux/etherdevice.h:25,
                 from drivers/net/ethernet/mellanox/mlx4/fw.c:35:
include/uapi/linux/swab.h:106:23: warning: ‘config_dev.vxlan_udp_dport’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  (__builtin_constant_p((__u16)(x)) ? \
                       ^
drivers/net/ethernet/mellanox/mlx4/fw.c:2114:25: note: ‘config_dev.vxlan_udp_dport’ was declared here
  struct mlx4_config_dev config_dev;
                         ^

Do you see them too?

Marcelo

#1 lore raw
Quoted 9 lines · Marcelo Ricardo Leitner

Hi Or,

Building net-next.git from today, 4e7a84b1a5bc8094522fd11f628b00c4b4e78b4d, I'm seeing these warnings on mlx4:

drivers/net/ethernet/mellanox/mlx4/fw.c: In function ‘mlx4_config_dev_retrieval’:
drivers/net/ethernet/mellanox/mlx4/fw.c:2136:12: warning: ‘config_dev.rx_checksum_val’ may be used uninitialized in this function [-Wmaybe-uninitialized]
csum_mask = (config_dev.rx_checksum_val >> CONFIG_DEV_RX_CSUM_MODE_PORT2_BIT_OFFSET) &

             ^

BTW in net-next.git this is line 2155 .. it's 2136 on net.git

Quoted 19 lines

In file included from include/linux/swab.h:4:0,

                  from include/uapi/linux/byteorder/little_endian.h:12,
                  from include/linux/byteorder/little_endian.h:4,
                  from ./arch/x86/include/uapi/asm/byteorder.h:4,
                  from include/asm-generic/bitops/le.h:5,
                  from ./arch/x86/include/asm/bitops.h:504,
                  from include/linux/bitops.h:36,
                  from include/linux/kernel.h:10,
                  from include/linux/skbuff.h:17,
                  from include/linux/if_ether.h:23,
                  from include/linux/etherdevice.h:25,
                  from drivers/net/ethernet/mellanox/mlx4/fw.c:35:
include/uapi/linux/swab.h:106:23: warning: ‘config_dev.vxlan_udp_dport’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   (__builtin_constant_p((__u16)(x)) ? \
                        ^
drivers/net/ethernet/mellanox/mlx4/fw.c:2114:25: note: ‘config_dev.vxlan_udp_dport’ was declared here
   struct mlx4_config_dev config_dev;
                          ^
Quoted 1 line

Do you see them too?

using $ make W=1 -j 20 SUBDIRS=./drivers/net/ethernet/mellanox/mlx4 with gcc 4.8.2 I don't see that, but I'll look there, thanks for the report.

Or.

#2 lore raw
Quoted 14 lines · Or Gerlitz
Quoted 5 lines · Marcelo Ricardo Leitner

Hi Or,

Building net-next.git from today, 4e7a84b1a5bc8094522fd11f628b00c4b4e78b4d, I'm seeing these warnings on mlx4:

Quoted 8 lines

drivers/net/ethernet/mellanox/mlx4/fw.c: In function ‘mlx4_config_dev_retrieval’:
drivers/net/ethernet/mellanox/mlx4/fw.c:2136:12: warning:
‘config_dev.rx_checksum_val’ may be used uninitialized in this function [-Wmaybe-uninitialized]
csum_mask = (config_dev.rx_checksum_val >>
CONFIG_DEV_RX_CSUM_MODE_PORT2_BIT_OFFSET) &

             ^
Quoted 1 line

BTW in net-next.git this is line 2155 .. it's 2136 on net.git

sure?
https://kernel.googlesource.com/pub/scm/linux/kernel/git/davem/net-next/+/4e7a84b1a5bc8094522fd11f628b00c4b4e78b4d/drivers/net/ethernet/mellanox/mlx4/fw.c
or
https://kernel.googlesource.com/pub/scm/linux/kernel/git/davem/net-next/+/master/drivers/net/ethernet/mellanox/mlx4/fw.c
says line 2136 for net-next too

Quoted 21 lines
Quoted 21 lines

In file included from include/linux/swab.h:4:0,

                  from include/uapi/linux/byteorder/little_endian.h:12,
                  from include/linux/byteorder/little_endian.h:4,
                  from ./arch/x86/include/uapi/asm/byteorder.h:4,
                  from include/asm-generic/bitops/le.h:5,
                  from ./arch/x86/include/asm/bitops.h:504,
                  from include/linux/bitops.h:36,
                  from include/linux/kernel.h:10,
                  from include/linux/skbuff.h:17,
                  from include/linux/if_ether.h:23,
                  from include/linux/etherdevice.h:25,
                  from drivers/net/ethernet/mellanox/mlx4/fw.c:35:
include/uapi/linux/swab.h:106:23: warning: ‘config_dev.vxlan_udp_dport’ may
be used uninitialized in this function [-Wmaybe-uninitialized]
   (__builtin_constant_p((__u16)(x)) ? \
                        ^
drivers/net/ethernet/mellanox/mlx4/fw.c:2114:25: note:
‘config_dev.vxlan_udp_dport’ was declared here
   struct mlx4_config_dev config_dev;
                          ^
Quoted 5 lines
Quoted 1 line

Do you see them too?

using $ make W=1 -j 20 SUBDIRS=./drivers/net/ethernet/mellanox/mlx4 with gcc 4.8.2 I don't see that, but I'll look there,
thanks for the report.

Aye, thanks.

Marcelo

#3 lore raw
Quoted 1 line · Marcelo Ricardo Leitner

On 15-01-2015 11:20, Or Gerlitz wrote:

...

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

Do you see them too?

using $ make W=1 -j 20 SUBDIRS=./drivers/net/ethernet/mellanox/mlx4 with gcc 4.8.2 I don't see that, but I'll look there,
thanks for the report.

I believe they are there for quite some time already. I'm using gcc 4.8.3 and just default build. I'm surprised Fengguang didn't complain yet (or he did, but it got ignored somehow ;)). The following should be sufficient to just shut gcc up:

drivers/net/ethernet/mellanox/mlx4/fw.c +1 -0
index 982861d..b01154d 100644
@@ -2122,6 +2122,7 @@ int mlx4_config_dev_retrieval(struct mlx4_dev *dev,
 	if (!(dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_CONFIG_DEV))
 		return -ENOTSUPP;
 
+	memset(&config_dev, 0, sizeof(config_dev));
 	err = mlx4_CONFIG_DEV_get(dev, &config_dev);
 	if (err)
 		return err;
#4 lore raw
Quoted 19 lines · Daniel Borkmann
Quoted 1 line · Marcelo Ricardo Leitner

On 15-01-2015 11:20, Or Gerlitz wrote:

...

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

Do you see them too?

using $ make W=1 -j 20 SUBDIRS=./drivers/net/ethernet/mellanox/mlx4 with gcc 4.8.2 I don't see that, but I'll look there,
thanks for the report.

I believe they are there for quite some time already. I'm using gcc 4.8.3 and just default build. I'm surprised Fengguang didn't complain yet (or he did, but it got ignored somehow ;)). The following should be sufficient to just shut gcc up:

drivers/net/ethernet/mellanox/mlx4/fw.c +0 -0
index 982861d..b01154d 100644

drivers/net/ethernet/mellanox/mlx4/fw.c int mlx4_config_dev_retrieval(struct mlx4_dev *dev, · line 2128

Quoted 7 lines
drivers/net/ethernet/mellanox/mlx4/fw.c +1 -0
@@ -2122,6 +2122,7 @@ int mlx4_config_dev_retrieval(struct mlx4_dev *dev,
  	if (!(dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_CONFIG_DEV))
  		return -ENOTSUPP;
 
+	memset(&config_dev, 0, sizeof(config_dev));
  	err = mlx4_CONFIG_DEV_get(dev, &config_dev);
  	if (err)
  		return err;

Yeah, I reported the same issue some time back.