* [PATCH net-next] caif: Replace memset(0) + strscpy() with strscpy_pad()
@ 2025-08-11 9:34 Thorsten Blum
2025-08-12 21:20 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2025-08-11 9:34 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Arnd Bergmann
Cc: Thorsten Blum, netdev, linux-kernel
Replace memset(0) followed by strscpy() with strscpy_pad() to improve
cfctrl_linkup_request(). 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>
---
net/caif/cfctrl.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/caif/cfctrl.c b/net/caif/cfctrl.c
index 06b604cf9d58..2aa1e7d46eb2 100644
--- a/net/caif/cfctrl.c
+++ b/net/caif/cfctrl.c
@@ -257,9 +257,7 @@ int cfctrl_linkup_request(struct cflayer *layer,
cfpkt_add_body(pkt, &tmp16, 2);
tmp16 = cpu_to_le16(param->u.utility.fifosize_bufs);
cfpkt_add_body(pkt, &tmp16, 2);
- memset(utility_name, 0, sizeof(utility_name));
- strscpy(utility_name, param->u.utility.name,
- UTILITY_NAME_LENGTH);
+ strscpy_pad(utility_name, param->u.utility.name);
cfpkt_add_body(pkt, utility_name, UTILITY_NAME_LENGTH);
tmp8 = param->u.utility.paramlen;
cfpkt_add_body(pkt, &tmp8, 1);
--
2.50.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] caif: Replace memset(0) + strscpy() with strscpy_pad()
2025-08-11 9:34 [PATCH net-next] caif: Replace memset(0) + strscpy() with strscpy_pad() Thorsten Blum
@ 2025-08-12 21:20 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-08-12 21:20 UTC (permalink / raw)
To: Thorsten Blum
Cc: davem, edumazet, kuba, pabeni, horms, arnd, netdev, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 11 Aug 2025 11:34:40 +0200 you wrote:
> Replace memset(0) followed by strscpy() with strscpy_pad() to improve
> cfctrl_linkup_request(). 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] caif: Replace memset(0) + strscpy() with strscpy_pad()
https://git.kernel.org/netdev/net-next/c/63fe077c21d3
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-12 21:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-11 9:34 [PATCH net-next] caif: Replace memset(0) + strscpy() with strscpy_pad() Thorsten Blum
2025-08-12 21:20 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.