1
0
Fork 0
alistair23-linux/drivers/net/ethernet/broadcom
Arnd Bergmann 3d46eee5a5 bnxt_en: avoid string overflow for record->system_name
The utsname()->nodename string may be 64 bytes long, and it gets
copied without the trailing nul byte into the shorter record->system_name,
as gcc now warns:

In file included from include/linux/bitmap.h:9,
                 from include/linux/ethtool.h:16,
                 from drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:13:
In function 'strncpy',
    inlined from 'bnxt_fill_coredump_record' at drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:2863:2:
include/linux/string.h:254:9: error: '__builtin_strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]

Using strlcpy() at least avoids overflowing the destination buffer
and adds proper nul-termination. It may still truncate long names
though, which probably can't be solved here.

Fixes: 6c5657d085 ("bnxt_en: Add support for ethtool get dump.")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-08-13 20:45:49 -07:00
..
bnx2x Merge ra.kernel.org:/pub/scm/linux/kernel/git/davem/net 2018-07-24 19:21:58 -07:00
bnxt bnxt_en: avoid string overflow for record->system_name 2018-08-13 20:45:49 -07:00
genet net/dim: Rename *_get_profile() functions to *_get_rx_moderation() 2018-04-24 10:15:07 -04:00
Kconfig bnxt_en: Add hwmon sysfs support to read temperature 2018-08-05 17:08:26 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
b44.c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
b44.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bcm63xx_enet.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
bcm63xx_enet.h bcm63xx_enet: use platform device id directly for miibus name 2017-12-19 11:07:16 -05:00
bcmsysport.c net: systemport: Add support for WAKE_FILTER 2018-08-07 12:15:03 -07:00
bcmsysport.h net: systemport: Add support for WAKE_FILTER 2018-08-07 12:15:03 -07:00
bgmac-bcma-mdio.c net: bgmac: use PHY subsystem for initializing PHY 2017-01-31 13:44:49 -05:00
bgmac-bcma.c net: bgmac: enable master mode for BCM54210E and B50212E PHYs 2017-10-12 22:59:38 -07:00
bgmac-platform.c net: ethernet: bgmac: mark expected switch fall-through 2017-11-11 18:49:26 +09:00
bgmac.c net: bgmac: remove redundant variable 'freed' 2018-07-04 22:39:11 +09:00
bgmac.h net: bgmac: Correctly annotate register space 2018-04-01 22:20:48 -04:00
bnx2.c treewide: Use array_size() in vzalloc() 2018-06-12 16:19:22 -07:00
bnx2.h ethernet/broadcom: use core min/max MTU checking 2016-10-18 11:34:18 -04:00
bnx2_fw.h bnx2-cnic: Driver Rebranding Changes 2015-02-20 15:46:49 -05:00
cnic.c cnic: use kvzalloc to allocate memory for csk_tbl 2018-07-11 22:55:52 -07:00
cnic.h cnic: Rebranding cnic driver. 2014-06-25 16:27:27 -07:00
cnic_defs.h cnic: Rebranding cnic driver. 2014-06-25 16:27:27 -07:00
cnic_if.h cnic: Add the interfaces to get FC-NPIV table. 2015-08-06 21:54:12 -07:00
sb1250-mac.c ethernet: Use octal not symbolic permissions 2018-03-26 12:07:49 -04:00
tg3.c Merge ra.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux 2018-07-20 21:17:12 -07:00
tg3.h tg3: Update copyright 2018-07-16 14:42:10 -07:00