Commit 7574cc58 authored by Wolfram Sang's avatar Wolfram Sang Committed by Jakub Kicinski

ipv6: move from strlcpy with unused retval to strscpy

Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20220818210220.8491-1-wsa+renesas@sang-engineering.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 01e454f2
...@@ -360,7 +360,7 @@ static struct ip6_tnl *ip6gre_tunnel_locate(struct net *net, ...@@ -360,7 +360,7 @@ static struct ip6_tnl *ip6gre_tunnel_locate(struct net *net,
if (parms->name[0]) { if (parms->name[0]) {
if (!dev_valid_name(parms->name)) if (!dev_valid_name(parms->name))
return NULL; return NULL;
strlcpy(name, parms->name, IFNAMSIZ); strscpy(name, parms->name, IFNAMSIZ);
} else { } else {
strcpy(name, "ip6gre%d"); strcpy(name, "ip6gre%d");
} }
......
...@@ -293,7 +293,7 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct __ip6_tnl_parm *p) ...@@ -293,7 +293,7 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct __ip6_tnl_parm *p)
if (p->name[0]) { if (p->name[0]) {
if (!dev_valid_name(p->name)) if (!dev_valid_name(p->name))
goto failed; goto failed;
strlcpy(name, p->name, IFNAMSIZ); strscpy(name, p->name, IFNAMSIZ);
} else { } else {
sprintf(name, "ip6tnl%%d"); sprintf(name, "ip6tnl%%d");
} }
......
...@@ -211,7 +211,7 @@ static struct ip6_tnl *vti6_tnl_create(struct net *net, struct __ip6_tnl_parm *p ...@@ -211,7 +211,7 @@ static struct ip6_tnl *vti6_tnl_create(struct net *net, struct __ip6_tnl_parm *p
if (p->name[0]) { if (p->name[0]) {
if (!dev_valid_name(p->name)) if (!dev_valid_name(p->name))
goto failed; goto failed;
strlcpy(name, p->name, IFNAMSIZ); strscpy(name, p->name, IFNAMSIZ);
} else { } else {
sprintf(name, "ip6_vti%%d"); sprintf(name, "ip6_vti%%d");
} }
......
...@@ -254,7 +254,7 @@ static struct ip_tunnel *ipip6_tunnel_locate(struct net *net, ...@@ -254,7 +254,7 @@ static struct ip_tunnel *ipip6_tunnel_locate(struct net *net,
if (parms->name[0]) { if (parms->name[0]) {
if (!dev_valid_name(parms->name)) if (!dev_valid_name(parms->name))
goto failed; goto failed;
strlcpy(name, parms->name, IFNAMSIZ); strscpy(name, parms->name, IFNAMSIZ);
} else { } else {
strcpy(name, "sit%d"); strcpy(name, "sit%d");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment