linux_dsm_epyc7002/drivers/net/ethernet/freescale
Arnd Bergmann 3ded9f2b35 net: ethernet: freescale: fix false-positive string overflow warning
While compile-testing on arm64 with gcc-8.1, I ran into a build diagnostic:

drivers/net/ethernet/freescale/fec_main.c: In function 'fec_probe':
drivers/net/ethernet/freescale/fec_main.c:3517:25: error: '%d' directive writing between 1 and 10 bytes into a region of size 5 [-Werror=format-overflow=]
   sprintf(irq_name, "int%d", i);
                         ^~
drivers/net/ethernet/freescale/fec_main.c:3517:21: note: directive argument in the range [0, 2147483646]
   sprintf(irq_name, "int%d", i);
                     ^~~~~~~
drivers/net/ethernet/freescale/fec_main.c:3517:3: note: 'sprintf' output between 5 and 14 bytes into a destination of size 8
   sprintf(irq_name, "int%d", i);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It appears this has never shown on ppc32 or arm32 for an unknown reason, but
now gcc fails to identify that the 'irq_cnt' loop index has an upper bound
of 3, and instead uses a bogus range.

To work around the warning, this changes the sprintf to snprintf with the
correct buffer length.

Fixes: 78cc6e7ef9 ("net: ethernet: freescale: Allow FEC with COMPILE_TEST")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-05-30 13:16:44 -04:00
..
dpaa dpaa_eth: use true and false for boolean values 2018-03-23 13:17:11 -04:00
fman fsl/fman_port: remove redundant check on port->rev_info.major 2018-04-24 16:00:37 -04:00
fs_enet net: fs_enet: do not call phy_stop() in interrupts 2018-01-17 15:44:16 -05:00
fec_main.c net: ethernet: freescale: fix false-positive string overflow warning 2018-05-30 13:16:44 -04:00
fec_mpc52xx_phy.c mdio: Move allocation of interrupts into core 2016-01-07 14:31:26 -05:00
fec_mpc52xx.c net: Convert to using %pOF instead of full_name 2017-07-24 13:41:48 -07:00
fec_mpc52xx.h
fec_ptp.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-05-26 19:46:15 -04:00
fec.h net: ethernet: freescale: Allow FEC with COMPILE_TEST 2018-05-17 17:11:06 -04:00
fsl_pq_mdio.c net/fsl_pq_mdio: Allow explicit speficition of TBIPA address 2018-04-08 12:44:49 -04:00
gianfar_ethtool.c net: ethernet: gianfar_ethtool: get phc index through drvdata 2018-05-28 23:05:11 -04:00
gianfar.c gianfar: Fix Rx byte accounting for ndev stats 2018-02-28 10:59:33 -05:00
gianfar.h net: ethernet: gianfar_ethtool: get phc index through drvdata 2018-05-28 23:05:11 -04:00
Kconfig net: ethernet: freescale: Allow FEC with COMPILE_TEST 2018-05-17 17:11:06 -04:00
Makefile ptp: rework gianfar_ptp as QorIQ common PTP driver 2018-05-28 23:05:11 -04:00
ucc_geth_ethtool.c net: ethernet: ucc: fix spelling mistake: "tx-late-collsion" -> "tx-late-collision" 2018-04-30 09:29:39 -04:00
ucc_geth.c net/ethernet/freescale: fix warning for ucc_geth 2017-09-18 14:56:34 -07:00
ucc_geth.h QE: Move QE from arch/powerpc to drivers/soc 2015-12-22 17:12:56 -06:00
xgmac_mdio.c net/fsl: use of_property_read_bool 2016-08-08 16:15:00 -07:00