net: Space: Replace memset(0) + strscpy() with strscpy_pad()
Subsystems (2)
PATCH 1/1 net: Space: Replace memset(0) + strscpy() with strscpy_pad()
Replace memset(0) followed by strscpy() with strscpy_pad() to improve netdev_boot_setup_add(). 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.
--- drivers/net/Space.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/Space.c +1 -2
@@ -67,8 +67,7 @@ static int netdev_boot_setup_add(char *name, struct ifmap *map) s = dev_boot_setup;for (i =0 ; i <NETDEV_BOOT_SETUP_MAX ; i++) {if (s[i].name[0 ] =='\0' || s[i].name[0 ] ==' ' ) { -memset (s[i].name,0 ,sizeof (s[i].name)); -strscpy (s[i].name, name,IFNAMSIZ ); +strscpy_pad (s[i].name, name);memcpy (&s[i].map, map,sizeof (s[i].map));break ; }
Signature · 1 line
2.50.1
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Thu, 14 Aug 2025 20:05:14 +0200 you wrote:
Replace memset(0) followed by
strscpy()withstrscpy_pad()to improvenetdev_boot_setup_add(). 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.Signed-off-by Thorsten Blum <[email protected]>[...]
Here is the summary with links:
- [net-next] net: Space: Replace memset(0) + strscpy() with strscpy_pad()
https://git.kernel.org/netdev/net-next/c/815957293639
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html