* [PATCH net-next] net: Space: Replace memset(0) + strscpy() with strscpy_pad()
@ 2025-08-14 18:05 Thorsten Blum
2025-08-15 19:50 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2025-08-14 18:05 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
Cc: Thorsten Blum, netdev, linux-kernel
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.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/net/Space.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/Space.c b/drivers/net/Space.c
index dc50797a2ed0..c01e2c2f7d6c 100644
--- a/drivers/net/Space.c
+++ b/drivers/net/Space.c
@@ -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;
}
--
2.50.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net: Space: Replace memset(0) + strscpy() with strscpy_pad()
2025-08-14 18:05 [PATCH net-next] net: Space: Replace memset(0) + strscpy() with strscpy_pad() Thorsten Blum
@ 2025-08-15 19:50 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-08-15 19:50 UTC (permalink / raw)
To: Thorsten Blum
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 14 Aug 2025 20:05:14 +0200 you wrote:
> 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.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
>
> [...]
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-15 19:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-14 18:05 [PATCH net-next] net: Space: Replace memset(0) + strscpy() with strscpy_pad() Thorsten Blum
2025-08-15 19:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).