net/sched: replace strncpy with strscpy
Subsystems (3)
PATCH v2 1/1 net/sched: replace strncpy with strscpy
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 <[email protected]>
--- net/sched/em_text.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/em_text.c +1 -1
@@ -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;
Signature · 1 line
2.49.0
Quoted 5 lines · Pranav Tyagi
Replace the deprecated
strncpy()with the two-argument version ofstrscpy()as the destination is an array
and buffer should be NUL-terminated.Signed-off-by Pranav Tyagi <[email protected]>
Thanks for the update.
Reviewed-by Simon Horman <[email protected]>
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 Fri, 20 Jun 2025 16:06:53 +0530 you wrote:
Replace the deprecated
strncpy()with the two-argument version ofstrscpy()as the destination is an array
and buffer should be NUL-terminated.Signed-off-by Pranav Tyagi <[email protected]>--- 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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html