From: Thorsten Blum Date: Sun, 17 Aug 2025 18:37:16 +0000 (+0200) Subject: MIPS: octeon: Replace memset(0) + deprecated strcpy() with strscpy_pad() X-Git-Tag: v6.18-rc1~69^2~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c7c8cf656b2712ece061346848664ab5ace72c6;p=thirdparty%2Fkernel%2Flinux.git MIPS: octeon: Replace memset(0) + deprecated strcpy() with strscpy_pad() Replace memset(0) followed by the deprecated strcpy() with strscpy_pad() to improve octeon_fdt_set_phy(). This avoids zeroing the memory before copying the string and ensures the destination buffer is only written to once, simplifying the code and improving efficiency. Link: https://github.com/KSPP/linux/issues/88 Signed-off-by: Thorsten Blum Reviewed-by: Justin Stitt Signed-off-by: Thomas Bogendoerfer --- diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c index 5e1dd4e6e82fb..47677b5d7ed00 100644 --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -538,8 +539,7 @@ static void __init octeon_fdt_set_phy(int eth, int phy_addr) if (octeon_has_88e1145()) { fdt_nop_property(initial_boot_params, phy, "marvell,reg-init"); - memset(new_name, 0, sizeof(new_name)); - strcpy(new_name, "marvell,88e1145"); + strscpy_pad(new_name, "marvell,88e1145"); p = fdt_getprop(initial_boot_params, phy, "compatible", ¤t_len); if (p && current_len >= strlen(new_name))