linux/drivers/net
Kees Cook 5252655127 net: ethernet: mtk_eth_soc: Avoid truncating allocation
[ Upstream commit f3eceaed9e ]

There doesn't appear to be a reason to truncate the allocation used for
flow_info, so do a full allocation and remove the unused empty struct.
GCC does not like having a reference to an object that has been
partially allocated, as bounds checking may become impossible when
such an object is passed to other code. Seen with GCC 13:

../drivers/net/ethernet/mediatek/mtk_ppe.c: In function 'mtk_foe_entry_commit_subflow':
../drivers/net/ethernet/mediatek/mtk_ppe.c:623:18: warning: array subscript 'struct mtk_flow_entry[0]' is partly outside array bounds of 'unsigned char[48]' [-Warray-bounds=]
  623 |         flow_info->l2_data.base_flow = entry;
      |                  ^~

Cc: Felix Fietkau <nbd@nbd.name>
Cc: John Crispin <john@phrozen.org>
Cc: Sean Wang <sean.wang@mediatek.com>
Cc: Mark Lee <Mark-MC.Lee@mediatek.com>
Cc: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: netdev@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/20230127223853.never.014-kees@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-02-22 12:59:43 +01:00
..
appletalk
arcnet
bonding bonding: fix error checking in bond_debug_reregister() 2023-02-14 19:11:44 +01:00
caif
can can: mcp251xfd: mcp251xfd_ring_set_ringparam(): assign missing tx_obj_num_coalesce_irq 2023-02-09 11:28:10 +01:00
dsa net: dsa: mt7530: don't change PVC_EG_TAG when CPU port becomes VLAN-aware 2023-02-14 19:11:46 +01:00
ethernet net: ethernet: mtk_eth_soc: Avoid truncating allocation 2023-02-22 12:59:43 +01:00
fddi net: defxx: Fix missing err handling in dfx_init() 2022-12-31 13:32:26 +01:00
fjes
hamradio hamradio: baycom_epp: Fix return type of baycom_send_packet() 2022-12-31 13:33:00 +01:00
hippi
hyperv hv_netvsc: Allocate memory in netvsc_dma_map() with GFP_ATOMIC 2023-02-14 19:11:40 +01:00
ieee802154
ipa net: ipa: disable ipa interrupt during suspend 2023-02-01 08:34:22 +01:00
ipvlan
mctp mctp: serial: Fix starting value for frame check sequence 2022-12-31 13:32:56 +01:00
mdio net: mdio-mux-meson-g12a: force internal PHY off on mux switch 2023-02-01 08:34:49 +01:00
netdevsim
pcs
phy net: phy: meson-gxl: use MMD access dummy stubs for GXL, internal PHY 2023-02-14 19:11:44 +01:00
plip net: plip: don't call kfree_skb/dev_kfree_skb() under spin_lock_irq() 2022-12-07 20:10:47 -08:00
ppp use less confusing names for iov_iter direction initializers 2023-02-09 11:28:04 +01:00
pse-pd
slip
team
usb net: USB: Fix wrong-direction WARNING in plusb.c 2023-02-14 19:11:51 +01:00
vmxnet3 vmxnet3: correctly report csum_level for encapsulated packet 2023-01-12 12:01:58 +01:00
vxlan vxlan: Fix memory leaks in error path 2023-01-12 12:02:25 +01:00
wan net: wan: Add checks for NULL for utdm in undo_uhdlc_init and unmap_si_regs 2023-02-01 08:34:17 +01:00
wireguard
wireless wifi: brcmfmac: Check the count value of channel spec to prevent out-of-bounds reads 2023-02-09 11:28:27 +01:00
wwan net: wwan: t7xx: Fix Runtime PM initialization 2023-02-09 11:28:05 +01:00
xen-netback xen/netback: fix build warning 2022-12-07 16:03:21 +01:00
amt.c
bareudp.c
dummy.c
eql.c
geneve.c
gtp.c
ifb.c
Kconfig
LICENSE.SRC
loopback.c
macsec.c net: macsec: fix net device access prior to holding a lock 2022-12-31 13:32:53 +01:00
macvlan.c
macvtap.c
Makefile
mdio.c
mhi_net.c
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c ntb_netdev: Use dev_kfree_skb_any() in interrupt context 2022-12-31 13:32:28 +01:00
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c
thunderbolt.c net: thunderbolt: fix memory leak in tbnet_open() 2022-12-08 09:07:37 -08:00
tun.c
veth.c veth: Fix race with AF_XDP exposing old or uninitialized descriptors 2023-01-12 12:01:59 +01:00
virtio_net.c virtio-net: Keep stop() to follow mirror sequence of open() 2023-02-09 11:28:11 +01:00
vrf.c net: vrf: determine the dst using the original ifindex for multicast 2023-01-12 12:01:57 +01:00
vsockmon.c
xen-netfront.c