]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net/sched: replace strncpy with strscpy
authorPranav Tyagi <pranav.tyagi03@gmail.com>
Fri, 20 Jun 2025 10:36:53 +0000 (16:06 +0530)
committerJakub Kicinski <kuba@kernel.org>
Mon, 23 Jun 2025 23:56:51 +0000 (16:56 -0700)
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 <pranav.tyagi03@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250620103653.6957-1-pranav.tyagi03@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/sched/em_text.c

index 420c66203b1777632500ee3d5e2d89a46b50bc4c..6b3d0af72c39c7fb1e3290e24bf94f5bf9e0b358 100644 (file)
@@ -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;