android_kernel_oneplus_msm8998/drivers/net/ethernet/brocade/bna
Arnd Bergmann 359f702046 bna: avoid writing uninitialized data into hw registers
[ Upstream commit a5af83925363eb85d467933e3d6ec5a87001eb7c ]

The latest gcc-7 snapshot warns about bfa_ioc_send_enable/bfa_ioc_send_disable
writing undefined values into the hardware registers:

drivers/net/ethernet/brocade/bna/bfa_ioc.c: In function 'bfa_iocpf_sm_disabling_entry':
arch/arm/include/asm/io.h:109:22: error: '*((void *)&disable_req+4)' is used uninitialized in this function [-Werror=uninitialized]
arch/arm/include/asm/io.h:109:22: error: '*((void *)&disable_req+8)' is used uninitialized in this function [-Werror=uninitialized]

The two functions look like they should do the same thing, but only one
of them initializes the time stamp and clscode field. The fact that we
only get a warning for one of the two functions seems to be arbitrary,
based on the inlining decisions in the compiler.

To address this, I'm making both functions do the same thing:

- set the clscode from the ioc structure in both
- set the time stamp from ktime_get_real_seconds (which also
  avoids the signed-integer overflow in 2038 and extends the
  well-defined behavior until 2106).
- zero-fill the reserved field

Fixes: 8b230ed8ec ("bna: Brocade 10Gb Ethernet device driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-25 14:22:12 +01:00
..
bfa_cee.c
bfa_cee.h
bfa_cs.h
bfa_defs.h
bfa_defs_cna.h
bfa_defs_mfg_comm.h
bfa_defs_status.h
bfa_ioc.c
bfa_ioc.h
bfa_ioc_ct.c
bfa_msgq.c
bfa_msgq.h
bfi.h
bfi_cna.h
bfi_enet.h
bfi_reg.h
bna.h
bna_enet.c
bna_hw_defs.h
bna_tx_rx.c
bna_types.h
bnad.c
bnad.h
bnad_debugfs.c
bnad_ethtool.c
cna.h
cna_fwimg.c
Kconfig
Makefile