Thread (3 messages) flat view 3 messages, 3 authors, 14d ago
COOLING14d

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

From: Lalit Shankar Chowdhury <hidden>
Date: 2026-09-09 21:07:38
Also in: lkml
Subsystem: networking [general], networking [ipsec], networking [ipv4/ipv6], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Steffen Klassert, Herbert Xu, David Ahern, Ido Schimmel, Linus Torvalds

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);
 	}
 	err = -ENOMEM;
 	dev = alloc_netdev(sizeof(*t), name, NET_NAME_UNKNOWN,
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index ab94b3a4ba9c..182a7949d830 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -210,7 +210,7 @@ static struct ip6_tnl *vti6_tnl_create(struct net *net, struct __ip6_tnl_parm *p
 			goto failed;
 		strscpy(name, p->name, IFNAMSIZ);
 	} else {
-		sprintf(name, "ip6_vti%%d");
+		strscpy(name, "ip6_vti%d", IFNAMSIZ);
 	}
 
 	dev = alloc_netdev(sizeof(*t), name, NET_NAME_UNKNOWN, vti6_dev_setup);
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 3f2ed9b77deb..20ac8cb87468 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -692,7 +692,7 @@ static struct net_device *ip6mr_reg_vif(struct net *net, struct mr_table *mrt)
 	char name[IFNAMSIZ];
 
 	if (mrt->id == RT6_TABLE_DFLT)
-		sprintf(name, "pim6reg");
+		strscpy(name, "pim6reg", IFNAMSIZ);
 	else
 		sprintf(name, "pim6reg%u", mrt->id);
 
-- 
2.53.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help