Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1609272
| From | David Miller <davem@davemloft.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RESEND PATCH 2/3] net: hns: avoid gcc-7.0.1 warning for uninitialized data |
| Date | 2017-03-26 05:10 +0200 |
| Message-ID | <tp6J4-23A-3@gated-at.bofh.it> (permalink) |
| References | <toFzb-83Q-1@gated-at.bofh.it> <toFzc-83Q-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Arnd Bergmann <arnd@arndb.de>
Date: Fri, 24 Mar 2017 23:02:50 +0100
> hns_dsaf_set_mac_key() calls dsaf_set_field() on an uninitialized field,
> which will then change only a few of its bits, causing a warning with
> the latest gcc:
>
> hisilicon/hns/hns_dsaf_main.c: In function 'hns_dsaf_set_mac_uc_entry':
> hisilicon/hns/hns_dsaf_reg.h:1046:12: error: 'mac_key.low.bits.port_vlan' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> (origin) &= (~(mask)); \
> ^~
> hisilicon/hns/hns_dsaf_main.c: In function 'hns_dsaf_set_mac_mc_entry':
> hisilicon/hns/hns_dsaf_reg.h:1046:12: error: 'mac_key.low.bits.port_vlan' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> hisilicon/hns/hns_dsaf_main.c: In function 'hns_dsaf_add_mac_mc_port':
> hisilicon/hns/hns_dsaf_reg.h:1046:12: error: 'mac_key.low.bits.port_vlan' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> hisilicon/hns/hns_dsaf_main.c: In function 'hns_dsaf_del_mac_entry':
> hisilicon/hns/hns_dsaf_reg.h:1046:12: error: 'mac_key.low.bits.port_vlan' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> hisilicon/hns/hns_dsaf_main.c: In function 'hns_dsaf_rm_mac_addr':
> hisilicon/hns/hns_dsaf_reg.h:1046:12: error: 'mac_key.low.bits.port_vlan' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> hisilicon/hns/hns_dsaf_main.c: In function 'hns_dsaf_del_mac_mc_port':
> hisilicon/hns/hns_dsaf_reg.h:1046:12: error: 'mac_key.low.bits.port_vlan' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> hisilicon/hns/hns_dsaf_main.c: In function 'hns_dsaf_get_mac_uc_entry':
> hisilicon/hns/hns_dsaf_reg.h:1046:12: error: 'mac_key.low.bits.port_vlan' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> hisilicon/hns/hns_dsaf_main.c: In function 'hns_dsaf_get_mac_mc_entry':
> hisilicon/hns/hns_dsaf_reg.h:1046:12: error: 'mac_key.low.bits.port_vlan' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>
> The code is actually correct since we always set all 16 bits of the
> port_vlan field, but gcc correctly points out that the first
> access does contain uninitialized data.
>
> This initializes the field to zero first before setting the
> individual bits.
>
> Fixes: 5483bfcb169c ("net: hns: modify tcam table and set mac key")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Applied.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RESEND PATCH 0/3] hisilicon hns warning fixes for gcc-7.0.1 Arnd Bergmann <arnd@arndb.de> - 2017-03-24 23:10 +0100
[RESEND PATCH 3/3] infiniband: hns: avoid gcc-7.0.1 warning for uninitialized data Arnd Bergmann <arnd@arndb.de> - 2017-03-24 23:10 +0100
[RESEND PATCH 2/3] net: hns: avoid gcc-7.0.1 warning for uninitialized data Arnd Bergmann <arnd@arndb.de> - 2017-03-24 23:10 +0100
Re: [RESEND PATCH 2/3] net: hns: avoid gcc-7.0.1 warning for uninitialized data David Miller <davem@davemloft.net> - 2017-03-26 05:10 +0200
[RESEND PATCH 1/3] net: hns: fix uninitialized data use Arnd Bergmann <arnd@arndb.de> - 2017-03-24 23:10 +0100
Re: [RESEND PATCH 1/3] net: hns: fix uninitialized data use David Miller <davem@davemloft.net> - 2017-03-26 05:20 +0200
csiph-web