From: David Laight <david.laight.linux@gmail•com>
To: Helge Deller <deller@gmx•de>
Cc: Ai Chao <aichao@kylinos•cn>,
nicolas.ferre@microchip•com, alexandre.belloni@bootlin•com,
claudiu.beznea@tuxon•dev, linux@armlinux•org.uk,
dilinger@queued•net, adaplas@gmail•com,
James.Bottomley@HansenPartnership•com, FlorianSchandinat@gmx•de,
alchark@gmail•com, krzk@kernel•org, kees@kernel•org,
rene@exactco•de, tzimmermann@suse•de, rongqianfeng@vivo•com,
thorsten.blum@linux•dev, chelsyratnawat2001@gmail•com,
soci@c64•rulez.org, gregkh@linuxfoundation•org, daniel@thingy•jp,
linmq006@gmail•com, fourier.thomas@gmail•com,
linux-fbdev@vger•kernel.org, dri-devel@lists•freedesktop.org,
linux-kernel@vger•kernel.org,
linux-arm-kernel@lists•infradead.org,
linux-geode@lists•infradead.org, linux-parisc@vger•kernel.org
Subject: Re: [PATCH 03/35] fbdev: sisfb: Use safer strscpy() instead of strcpy()
Date: Sat, 25 Apr 2026 12:02:35 +0100 [thread overview]
Message-ID: <20260425120235.2ec10089@pumpkin> (raw)
In-Reply-To: <ccd01f97-d4b7-4bd0-92c1-adc3b1136cbc@gmx.de>
On Sat, 25 Apr 2026 10:08:08 +0200
Helge Deller <deller@gmx•de> wrote:
> Hello Ai,
...
> > - strcpy(ivideo->myid, "SiS 730");
> > + strscpy(ivideo->myid, "SiS 730");
>
> The compiler knows at build time the length of myid, and the "SIS 730" string.
> Using strscpy() has no benefit here either. Contrary, the code generated
> because of using strscpy() is probably even larger.
> Don't replace such code with strscpy().
Both should get converted to a memcpy().
If you increase the literal to be too long I'm pretty sure you'll
get a compiler warning/error from strcpy().
OTOH strscpy() is more likely to truncate the string (I'd need to
check).
So leaving it as strcpy() is fine - and possibly even better.
The header files might get changed to error strcpy() unless the compiler
knows the source string has a constant length and the destination is
big enough - but that hasn't been done yet.
David
next prev parent reply other threads:[~2026-04-25 11:02 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-25 6:58 [PATCH 00/35] Use safer strscpy() instead of strcpy() Ai Chao
2026-04-25 6:58 ` [PATCH 01/35] fbdev: matroxfb: " Ai Chao
2026-04-25 6:58 ` [PATCH 02/35] fbdev: i810: " Ai Chao
2026-04-25 6:58 ` [PATCH 03/35] fbdev: sisfb: " Ai Chao
2026-04-25 8:08 ` Helge Deller
2026-04-25 11:02 ` David Laight [this message]
2026-04-25 6:58 ` [PATCH 04/35] fbdev: geode: " Ai Chao
2026-04-25 6:58 ` [PATCH 05/35] fbdev: atafb: " Ai Chao
2026-04-25 6:58 ` [PATCH 06/35] fbdev: tdfxfb: " Ai Chao
2026-04-25 6:58 ` [PATCH 07/35] fbdev: pm2fb: " Ai Chao
2026-04-25 6:58 ` [PATCH 08/35] fbdev: xen-fbfront: " Ai Chao
2026-04-25 6:59 ` [PATCH 09/35] fbdev: controlfb: " Ai Chao
2026-04-25 6:59 ` [PATCH 10/35] fbdev: stifb: " Ai Chao
2026-04-25 6:59 ` [PATCH 11/35] fbdev: fm2fb: " Ai Chao
2026-04-25 6:59 ` [PATCH 12/35] fbdev: arkfb: " Ai Chao
2026-04-25 6:59 ` [PATCH 13/35] fbdev: vt8500lcdfb: " Ai Chao
2026-04-25 6:59 ` [PATCH 14/35] fbdev: vt8623fb: " Ai Chao
2026-04-25 6:59 ` [PATCH 15/35] fbdev: gbefb: " Ai Chao
2026-04-25 6:59 ` [PATCH 16/35] fbdev: wm8505fb: " Ai Chao
2026-04-25 6:59 ` [PATCH 17/35] fbdev: rivafb: " Ai Chao
2026-04-25 6:59 ` [PATCH 18/35] fbdev: sh7760fb: " Ai Chao
2026-04-25 6:59 ` [PATCH 19/35] fbdev: savage: " Ai Chao
[not found] <20260427090910.1940231-1-aichao@kylinos.cn>
2026-04-27 9:17 ` [PATCH 03/35] fbdev: sisfb: " Helge Deller
2026-04-27 13:05 ` 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=20260425120235.2ec10089@pumpkin \
--to=david.laight.linux@gmail$(echo .)com \
--cc=FlorianSchandinat@gmx$(echo .)de \
--cc=James.Bottomley@HansenPartnership$(echo .)com \
--cc=adaplas@gmail$(echo .)com \
--cc=aichao@kylinos$(echo .)cn \
--cc=alchark@gmail$(echo .)com \
--cc=alexandre.belloni@bootlin$(echo .)com \
--cc=chelsyratnawat2001@gmail$(echo .)com \
--cc=claudiu.beznea@tuxon$(echo .)dev \
--cc=daniel@thingy$(echo .)jp \
--cc=deller@gmx$(echo .)de \
--cc=dilinger@queued$(echo .)net \
--cc=dri-devel@lists$(echo .)freedesktop.org \
--cc=fourier.thomas@gmail$(echo .)com \
--cc=gregkh@linuxfoundation$(echo .)org \
--cc=kees@kernel$(echo .)org \
--cc=krzk@kernel$(echo .)org \
--cc=linmq006@gmail$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-fbdev@vger$(echo .)kernel.org \
--cc=linux-geode@lists$(echo .)infradead.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-parisc@vger$(echo .)kernel.org \
--cc=linux@armlinux$(echo .)org.uk \
--cc=nicolas.ferre@microchip$(echo .)com \
--cc=rene@exactco$(echo .)de \
--cc=rongqianfeng@vivo$(echo .)com \
--cc=soci@c64$(echo .)rulez.org \
--cc=thorsten.blum@linux$(echo .)dev \
--cc=tzimmermann@suse$(echo .)de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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