[PATCH v2 net-next] net/sched: replace strncpy with strscpy

Subsystems: networking [general], tc subsystem, the rest

STALE420d

3 messages, 3 authors, 2025-06-24 · open the first message on its own page

[PATCH v2 net-next] net/sched: replace strncpy with strscpy

From: Pranav Tyagi <hidden>
Date: 2025-06-20 10:37:05

Replace the deprecated strncpy() with the two-argument version of
strscpy() as the destination is an array
and buffer should be NUL-terminated.

Signed-off-by: Pranav Tyagi <redacted>
---
 net/sched/em_text.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sched/em_text.c b/net/sched/em_text.c
index 420c66203b17..6b3d0af72c39 100644
--- a/net/sched/em_text.c
+++ b/net/sched/em_text.c
@@ -108,7 +108,7 @@ static int em_text_dump(struct sk_buff *skb, struct tcf_ematch *m)
 	struct text_match *tm = EM_TEXT_PRIV(m);
 	struct tcf_em_text conf;
 
-	strncpy(conf.algo, tm->config->ops->name, sizeof(conf.algo) - 1);
+	strscpy(conf.algo, tm->config->ops->name);
 	conf.from_offset = tm->from_offset;
 	conf.to_offset = tm->to_offset;
 	conf.from_layer = tm->from_layer;
-- 
2.49.0

Re: [PATCH v2 net-next] net/sched: replace strncpy with strscpy

From: Simon Horman <horms@kernel.org>
Date: 2025-06-20 19:59:23

On Fri, Jun 20, 2025 at 04:06:53PM +0530, Pranav Tyagi wrote:
Replace the deprecated strncpy() with the two-argument version of
strscpy() as the destination is an array
and buffer should be NUL-terminated.

Signed-off-by: Pranav Tyagi <redacted>
Thanks for the update.

Reviewed-by: Simon Horman <horms@kernel.org>

Re: [PATCH v2 net-next] net/sched: replace strncpy with strscpy

From: patchwork-bot+netdevbpf@kernel.org
Date: 2025-06-24 00:09:56

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski [off-list ref]:

On Fri, 20 Jun 2025 16:06:53 +0530 you wrote:
Replace the deprecated strncpy() with the two-argument version of
strscpy() as the destination is an array
and buffer should be NUL-terminated.

Signed-off-by: Pranav Tyagi <redacted>
---
 net/sched/em_text.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
  - [v2,net-next] net/sched: replace strncpy with strscpy
    https://git.kernel.org/netdev/net-next/c/b04202d6065c

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help