linux/drivers/net/ethernet/broadcom
Kees Cook 29fd0ec65e bnx2x: Use struct_group() for memcpy() region
In preparation for FORTIFY_SOURCE performing compile-time and run-time
field bounds checking for memcpy(), memmove(), and memset(), avoid
intentionally writing across neighboring fields.

Use struct_group() in struct nig_stats around members egress_mac_pkt0_lo,
egress_mac_pkt0_hi, egress_mac_pkt1_lo, and egress_mac_pkt1_hi (and the
respective members in struct bnx2x_eth_stats), so they can be referenced
together. This will allow memcpy() and sizeof() to more easily reason
about sizes, improve readability, and avoid future warnings about writing
beyond the end of struct bnx2x_eth_stats's rx_stat_ifhcinbadoctets_hi.

"pahole" shows no size nor member offset changes to either struct.
"objdump -d" shows no meaningful object code changes (i.e. only source
line number induced differences and optimizations).

Additionally adds BUILD_BUG_ON() to compare the separate struct group
sizes.

Reviewed-by: Prabhakar Kushwaha <pkushwaha@marvell.com>
Link: https://lore.kernel.org/lkml/DM5PR18MB2229B0413C372CC6E49D59A3B2C59@DM5PR18MB2229.namprd18.prod.outlook.com
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-11-19 11:18:08 +00:00
..
bnx2x bnx2x: Use struct_group() for memcpy() region 2021-11-19 11:18:08 +00:00
bnxt Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-11-18 13:13:16 -08:00
genet net: bcmgenet: Add support for 7712 16nm internal EPHY 2021-10-24 13:42:28 +01:00
b44.c ethernet: constify references to netdev->dev_addr in drivers 2021-10-14 09:22:11 -07:00
b44.h
bcm63xx_enet.c ethernet: use eth_hw_addr_set() 2021-10-02 14:18:25 +01:00
bcm63xx_enet.h bcm63xx_enet: convert to build_skb 2021-01-07 12:39:53 -08:00
bcm4908_enet.c net: broadcom: bcm4908_enet: use kcalloc() instead of kzalloc() 2021-10-07 09:08:16 -07:00
bcm4908_enet.h net: broadcom: rename BCM4908 driver & update DT binding 2021-02-11 15:04:17 -08:00
bcmsysport.c ethernet: constify references to netdev->dev_addr in drivers 2021-10-14 09:22:11 -07:00
bcmsysport.h net: broadcom: share header defining UniMAC registers 2021-01-08 19:17:28 -08:00
bgmac-bcma-mdio.c net: bgmac: support MDIO described in DT 2021-10-05 11:38:37 +01:00
bgmac-bcma.c ethernet: use of_get_ethdev_address() 2021-10-07 13:39:51 +01:00
bgmac-platform.c ethernet: use of_get_ethdev_address() 2021-10-07 13:39:51 +01:00
bgmac.c ethernet: constify references to netdev->dev_addr in drivers 2021-10-14 09:22:11 -07:00
bgmac.h net: broadcom: share header defining UniMAC registers 2021-01-08 19:17:28 -08:00
bnx2_fw.h
bnx2.c ethernet: constify references to netdev->dev_addr in drivers 2021-10-14 09:22:11 -07:00
bnx2.h
cnic_defs.h net: cnic: fix spelling mistake "reserverd" -> "reserved" 2020-02-17 21:59:16 -08:00
cnic_if.h
cnic.c cnic: convert tasklets to use new tasklet_setup() API 2020-09-14 13:02:37 -07:00
cnic.h
Kconfig ethernet: fix PTP_1588_CLOCK dependencies 2021-08-13 17:49:05 -07:00
Makefile net: broadcom: rename BCM4908 driver & update DT binding 2021-02-11 15:04:17 -08:00
sb1250-mac.c dev_ioctl: split out ndo_eth_ioctl 2021-07-27 20:11:45 +01:00
tg3.c tg3: Remove redundant assignments 2021-11-05 10:14:38 +00:00
tg3.h tg3: Read VPD with pci_vpd_alloc() 2021-08-20 15:49:00 -05:00
unimac.h net: broadcom: share header defining UniMAC registers 2021-01-08 19:17:28 -08:00