mirror_ubuntu-kernels/drivers/net
Justin Stitt d10d64ad01 igc: replace deprecated strncpy with strscpy
`strncpy` is deprecated for use on NUL-terminated destination strings
[1] and as such we should prefer more robust and less ambiguous string
interfaces.

We expect netdev->name to be NUL-terminated based on its use with format
strings:
|       if (q_vector->rx.ring && q_vector->tx.ring)
|               sprintf(q_vector->name, "%s-TxRx-%u", netdev->name,

Furthermore, we do not need NUL-padding as netdev is already
zero-allocated:
|       netdev = alloc_etherdev_mq(sizeof(struct igc_adapter),
|                                  IGC_MAX_TX_QUEUES);
...
alloc_etherdev() -> alloc_etherdev_mq() -> alloc_etherdev_mqs() ->
alloc_netdev_mqs() ...
|       p = kvzalloc(alloc_size, GFP_KERNEL_ACCOUNT | __GFP_RETRY_MAYFAIL);

Considering the above, a suitable replacement is `strscpy` [2] due to
the fact that it guarantees NUL-termination on the destination buffer
without unnecessarily NUL-padding.

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2]
Link: https://github.com/KSPP/linux/issues/90
Signed-off-by: Justin Stitt <justinstitt@google.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://lore.kernel.org/r/20231017190411.2199743-10-jacob.e.keller@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-10-18 18:10:18 -07:00
..
arcnet
bonding
caif
can Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-10-12 17:07:34 -07:00
dsa net: dsa: vsc73xx: replace deprecated strncpy with ethtool_sprintf 2023-10-13 16:28:35 -07:00
ethernet igc: replace deprecated strncpy with strscpy 2023-10-18 18:10:18 -07:00
fddi
fjes netdev: replace napi_reschedule with napi_schedule 2023-10-11 17:28:06 -07:00
hamradio hamradio: replace deprecated strncpy with strscpy_pad 2023-10-17 17:59:55 -07:00
hippi
hyperv hv_netvsc: fix netvsc_send_completion to avoid multiple message length checks 2023-10-11 09:19:01 +01:00
ieee802154 ieee802154: ca8210: Fix a potential UAF in ca8210_probe 2023-10-07 20:37:38 +02:00
ipa net: ipa: Annotate struct ipa_power with __counted_by 2023-10-02 11:24:54 -07:00
ipvlan
mctp mctp i3c: MCTP I3C driver 2023-10-17 12:45:03 +02:00
mdio net: mdio: xgene: Use device_get_match_data() 2023-10-13 10:15:05 +01:00
netdevsim
pcs
phy net: phylink: remove a bunch of unused validation methods 2023-10-17 17:51:53 -07:00
plip
ppp net: implement lockless SO_PRIORITY 2023-10-01 19:09:54 +01:00
pse-pd
slip
team team: fix null-ptr-deref when team device type is changed 2023-09-19 16:28:37 +02:00
thunderbolt
usb net: usb: replace deprecated strncpy with strscpy 2023-10-16 16:16:30 -07:00
vmxnet3
vxlan vxlan: use generic function for tunnel IPv4 route lookup 2023-10-16 09:57:52 +01:00
wan netdev: replace napi_reschedule with napi_schedule 2023-10-11 17:28:06 -07:00
wireguard
wireless wireless-next patches for v6.7 2023-10-17 16:52:54 -07:00
wwan drivers: net: wwan: iosm: Fixed multiple typos in multiple files 2023-10-18 17:45:44 -07:00
xen-netback xen-netback: add software timestamp capabilities 2023-10-13 10:19:50 +01:00
amt.c
bareudp.c ipv4: add new arguments to udp_tunnel_dst_lookup() 2023-10-16 09:57:52 +01:00
dummy.c
eql.c
geneve.c geneve: use generic function for tunnel IPv4 route lookup 2023-10-16 09:57:52 +01:00
gtp.c
ifb.c
Kconfig
LICENSE.SRC
loopback.c
macsec.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-10-12 17:07:34 -07:00
macvlan.c
macvtap.c
Makefile appletalk: remove ipddp driver 2023-10-10 17:49:00 -07:00
mdio.c
mhi_net.c
mii.c
net_failover.c
netconsole.c netconsole: Attach cmdline target to dynamic target 2023-10-13 17:26:38 -07:00
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c net: appletalk: remove cops support 2023-10-04 11:49:20 -07:00
sungem_phy.c
tap.c
tun.c
veth.c
virtio_net.c virtio-net: a tiny comment update 2023-10-11 07:13:50 +01:00
vrf.c
vsockmon.c
xen-netfront.c