From: "Álvaro Costa" <alvaroc.dev@gmail.com>
To: jiri@resnulli.us
Cc: "David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Simon Horman" <horms@kernel.org>,
netdev@vger.kernel.org, "Álvaro Costa" <alvaroc.dev@gmail.com>
Subject: [PATCH] devlink/param: replace deprecated strcpy() with strscpy()
Date: Thu, 23 Apr 2026 22:20:22 -0300 [thread overview]
Message-ID: <20260424012037.89619-1-alvaroc.dev@gmail.com> (raw)
Replace strcpy() call used to extract a string parameter from param_data
with strscpy(). Since strscpy() already performs bounds checking and
ensures the destination string is NUL-terminated, remove the string
length check as well.
Signed-off-by: Álvaro Costa <alvaroc.dev@gmail.com>
---
net/devlink/param.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/devlink/param.c b/net/devlink/param.c
index cf95268da5b0..26695b7e2861 100644
--- a/net/devlink/param.c
+++ b/net/devlink/param.c
@@ -536,11 +536,9 @@ devlink_param_value_get_from_info(const struct devlink_param *param,
value->vu64 = nla_get_u64(param_data);
break;
case DEVLINK_PARAM_TYPE_STRING:
- len = strnlen(nla_data(param_data), nla_len(param_data));
- if (len == nla_len(param_data) ||
- len >= __DEVLINK_PARAM_MAX_STRING_VALUE)
+ len = strscpy(value->vstr, nla_data(param_data));
+ if (len < 0)
return -EINVAL;
- strcpy(value->vstr, nla_data(param_data));
break;
case DEVLINK_PARAM_TYPE_BOOL:
if (param_data && nla_len(param_data))
--
2.53.0
next reply other threads:[~2026-04-24 1:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-24 1:20 Álvaro Costa [this message]
2026-04-24 1:31 ` [PATCH] devlink/param: replace deprecated strcpy() with strscpy() Jakub Kicinski
-- strict thread matches above, loose matches on Subject: below --
2026-05-06 21:14 Álvaro Costa
2026-05-06 22:42 ` Jakub Kicinski
2026-05-06 23:52 ` Álvaro Costa
2026-05-07 8:04 ` David Laight
2026-05-07 14:52 ` Jakub Kicinski
2026-05-07 21:10 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260424012037.89619-1-alvaroc.dev@gmail.com \
--to=alvaroc.dev@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.