1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/net/dsa
Justin Stitt e3bbab4754 net: dsa: vsc73xx: replace deprecated strncpy with ethtool_sprintf
`strncpy` is deprecated for use on NUL-terminated destination strings
[1] and as such we should prefer more robust and less ambiguous string
interfaces.

ethtool_sprintf() is designed specifically for get_strings() usage.
Let's replace strncpy in favor of this more robust and easier to
understand interface.

This change could result in misaligned strings when if(cnt) fails. To
combat this, use ternary to place empty string in buffer and properly
increment pointer to next string slot.

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>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20231010-strncpy-drivers-net-dsa-vitesse-vsc73xx-core-c-v2-1-ba4416a9ff23@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-10-13 16:28:35 -07:00
..
b53 net: dsa: b53: Convert to platform remove callback returning void 2023-09-20 10:25:57 +01:00
hirschmann net: dsa: hirschmann: Convert to platform remove callback returning void 2023-09-20 10:25:57 +01:00
microchip net: dsa: microchip: Fix uninitialized var in ksz9477_acl_move_entries() 2023-10-10 11:12:01 +02:00
mv88e6xxx Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-10-05 13:16:47 -07:00
ocelot net: dsa: ocelot: Convert to platform remove callback returning void 2023-09-20 10:25:57 +01:00
qca Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-10-12 17:07:34 -07:00
realtek net: dsa: realtek: rtl8365mb: replace deprecated strncpy with ethtool_sprintf 2023-10-10 20:05:23 -07:00
sja1105 net: dsa: sja1105: make read-only const arrays static 2023-09-21 16:12:12 +02:00
xrs700x net: dsa: propagate extack to ds->ops->port_hsr_join() 2023-10-03 13:51:02 +02:00
bcm_sf2.c net: dsa: bcm_sf2: Convert to platform remove callback returning void 2023-09-20 10:25:57 +01:00
bcm_sf2.h net: dsa: bcm_sf2: refactor LED regs access 2021-12-30 17:28:32 -08:00
bcm_sf2_cfp.c net: dsa: introduce dsa_port_get_master() 2022-09-20 10:32:35 +02:00
bcm_sf2_regs.h net: dsa: bcm_sf2: refactor LED regs access 2021-12-30 17:28:32 -08:00
dsa_loop.c net: dsa: dsa_loop: add phylink capabilities 2023-10-11 10:06:05 +01:00
dsa_loop.h
dsa_loop_bdinfo.c
Kconfig net: dsa: mt7530: improve and relax PHY driver dependency 2023-08-09 11:22:55 +01:00
lan9303-core.c net: dsa: Explicitly include correct DT includes 2023-07-26 21:54:16 -07:00
lan9303.h net: dsa: be compatible with masters which unregister on shutdown 2021-09-19 12:08:37 +01:00
lan9303_i2c.c net: dsa: Switch i2c drivers back to use .probe() 2023-05-31 09:52:55 +01:00
lan9303_mdio.c net: dsa: lan9303: drop of_match_ptr for ID table 2023-03-15 08:11:01 +00:00
lantiq_gswip.c net: dsa: lantiq_gswip: replace deprecated strncpy with ethtool_sprintf 2023-10-11 17:26:04 -07:00
lantiq_pce.h
Makefile net: dsa: mt7530: introduce driver for MT7988 built-in switch 2023-04-03 10:13:01 +01:00
mt7530-mdio.c net: dsa: mt7530: fix support for MT7531BE 2023-04-19 17:37:45 -07:00
mt7530-mmio.c net: dsa: mt7530: Convert to platform remove callback returning void 2023-09-20 10:25:57 +01:00
mt7530.c net: dsa: mt7530: replace deprecated strncpy with ethtool_sprintf 2023-10-11 17:25:48 -07:00
mt7530.h net: dsa: mt7530: fix handling of 802.1X PAE frames 2023-08-19 12:29:33 +01:00
mv88e6060.c net: dsa: mv88e6060: add phylink_get_caps implementation 2023-08-14 18:57:17 -07:00
mv88e6060.h
rzn1_a5psw.c net: dsa: rzn1_a5psw: Convert to platform remove callback returning void 2023-09-20 10:25:58 +01:00
rzn1_a5psw.h net: dsa: rzn1-a5psw: add vlan support 2023-08-11 11:58:36 +01:00
vitesse-vsc73xx-core.c net: dsa: vsc73xx: replace deprecated strncpy with ethtool_sprintf 2023-10-13 16:28:35 -07:00
vitesse-vsc73xx-platform.c net: dsa: vitesse-vsc73xx: Convert to platform remove callback returning void 2023-09-20 10:25:58 +01:00
vitesse-vsc73xx-spi.c net: dsa: vitesse-vsc73xx: remove unnecessary set_drvdata() 2022-09-22 19:30:39 -07:00
vitesse-vsc73xx.h net: dsa: vsc73xxx: Make vsc73xx_remove() return void 2021-11-15 13:15:07 +00:00