The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: Amin <amin.gattout@gmail.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/amdgpu: Replace deprecated strcpy with strscpy
Date: Wed, 19 Aug 2026 11:12:48 +0100	[thread overview]
Message-ID: <20260819111248.29286a7c@pumpkin> (raw)
In-Reply-To: <CADnq5_NhH0WC_r7SVPyXOG4r36O++sUGis2Ej-A9J4MNJu7GoA@mail.gmail.com>

On Tue, 18 Aug 2026 13:56:06 -0400
Alex Deucher <alexdeucher@gmail.com> wrote:

> On Tue, Aug 18, 2026 at 1:51 PM Amin <amin.gattout@gmail.com> wrote:
> >
> > You raise a fair point about the compile-time truncation check.
> > My reasoning follows the kernel's own deprecation guidance, which
> > explicitly lists strcpy() as deprecated and names strscpy() as the
> > safe replacement:
> >
> > https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy  
> 
> RIght.  My thinking was that strscpy() would be preferred to avoid
> static checkers from complaining about strcpy().

Personally I think the guidance (and checkpatch) should be changed.
It is pretty easy to change the header files to only allow safe
strcpy().
If nothing else that reduces pointless churn that just makes more
work for the maintainers.

There are plenty of strcpy() and strlcat() calls that are 'not obviously
correctly bounded' (and probably some strscpy() ones as well) which are
better targets for patches than the ones that are trivially valid.

David 

> 
> Alex

      reply	other threads:[~2026-08-19 10:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18 10:32 [PATCH] drm/amdgpu: Replace deprecated strcpy with strscpy Amin Gattout
2026-08-18 13:01 ` Alex Deucher
2026-08-18 14:21   ` David Laight
2026-08-18 17:39     ` Alex Deucher
2026-08-18 17:51       ` Amin
2026-08-18 17:56         ` Alex Deucher
2026-08-19 10:12           ` David Laight [this message]

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=20260819111248.29286a7c@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=amin.gattout@gmail.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=simona@ffwll.ch \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox