Thread (3 messages) 3 messages, 3 authors, 27d ago

Re: [PATCH] ipv6: replace sprintf() with no format specifiers with strscpy()

flat view

From: Hangbin Liu <hidden>
Date: 2026-09-10 07:09:22
Also in: lkml

Hi Lalit,
On Wed, Sep 09, 2026 at 09:05:52PM +0000, Lalit Shankar Chowdhury wrote:
quoted hunk ↗ jump to hunk
Multiple instances of sprintf() have no format specifiers. Replace
them with strscpy().

Signed-off-by: Lalit Shankar Chowdhury <redacted>
---
 net/ipv6/ip6_tunnel.c | 2 +-
 net/ipv6/ip6_vti.c    | 2 +-
 net/ipv6/ip6mr.c      | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index d5ff50a2ac01..ef3a6d931c9e 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -294,7 +294,7 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct __ip6_tnl_parm *p)
 			goto failed;
 		strscpy(name, p->name, IFNAMSIZ);
 	} else {
-		sprintf(name, "ip6tnl%%d");
+		strscpy(name, "ip6tnl%d", IFNAMSIZ);
The sprintf() is doing format expansion (%% -> %), the name will be used
in __dev_alloc_name() later. I think there is no need to change them.

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