All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: David Laight <david.laight.linux@gmail.com>
Cc: "Álvaro Costa" <alvaroc.dev@gmail.com>,
	jiri@resnulli.us, "David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Simon Horman" <horms@kernel.org>,
	netdev@vger.kernel.org (open list:DEVLINK),
	linux-kernel@vger.kernel.org (open list)
Subject: Re: [PATCH] devlink/param: replace deprecated strcpy() with strscpy()
Date: Thu, 7 May 2026 07:52:34 -0700	[thread overview]
Message-ID: <20260507075234.1630060f@kernel.org> (raw)
In-Reply-To: <20260507090445.3448d536@pumpkin>

On Thu, 7 May 2026 09:04:45 +0100 David Laight wrote:
> >  	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));  
> 
> The only sensible thing here is to replace the strcpy() with:
> 		memcpy(value->vstr, nla_data(param_data), len + 1);

That'd probably be a good move, to avoid getting the broken strscpy()
conversion submissions. Care to send a patch?

  reply	other threads:[~2026-05-07 14:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06 21:14 [PATCH] devlink/param: replace deprecated strcpy() with strscpy() Á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 [this message]
2026-05-07 21:10     ` David Laight
  -- strict thread matches above, loose matches on Subject: below --
2026-04-24  1:20 Álvaro Costa
2026-04-24  1:31 ` Jakub Kicinski

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=20260507075234.1630060f@kernel.org \
    --to=kuba@kernel.org \
    --cc=alvaroc.dev@gmail.com \
    --cc=davem@davemloft.net \
    --cc=david.laight.linux@gmail.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=linux-kernel@vger.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.