From: David Laight <david.laight.linux@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Heiko Carstens <hca@linux.ibm.com>, Kees Cook <kees@kernel.org>,
Manuel Ebner <manuelebner@mailbox.org>,
Andy Shevchenko <andy.shevchenko@gmail.com>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>,
Dwaipayan Ray <dwaipayanray1@gmail.com>,
Lukas Bulwahn <lukas.bulwahn@gmail.com>,
Randy Dunlap <rdunlap@infradead.org>,
Jani Nikula <jani.nikula@intel.com>,
"open list:DOCUMENTATION PROCESS" <workflows@vger.kernel.org>,
"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/3] Doc: deprecated.rst: add strlcat()
Date: Mon, 18 May 2026 13:59:26 +0100 [thread overview]
Message-ID: <20260518135926.0a916782@pumpkin> (raw)
In-Reply-To: <CAMuHMdXEezxGi1d=BCiQ57cbnG4D2PPXvt_FAHcyT5mgR7md3g@mail.gmail.com>
On Mon, 18 May 2026 09:11:04 +0200
Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> Hi David,
...
> > I don't really see why strlcat() should be deprecated.
> > Clearly there are many cases where there are better ways to do things.
>
> https://elixir.bootlin.com/linux/v7.0.8/source/include/linux/fortify-string.h#L346
> already says "Do not use this function. [...] Prefer building the
> * string with formatting, via scnprintf(), seq_buf, or similar.".
Trouble is that all requires a lot more rework.
I might try changing the type of the 'buffer' to sysfs_emit()
from 'char *' to 'sysfs_buf *'.
Initially the types will have to be the same, but propagating it through
will show where it can be used.
But last I looked I failed to even find the associated kmalloc().
Eventually it could be changed to a different type.
> > The only problem with strlcat() is that it returns the 'required length'.
> > So there are some broken uses.
> > - fs/nfs/flexfilelayout/flexfilelayout.c
> > - lib/kunit/string-stream.c (although the preceding vsnprintf() looks like the actual bug).
> > There is also some very strange code in security/selinus/ima.c - but it may be ok.
> >
> > In reality the return value of strlcat() isn't really much worse that that
> > of snprintf().
>
> So we need strscat()? ;-)
Indeed...
-- David
>
> Gr{oetje,eeting}s,
>
> Geert
>
next prev parent reply other threads:[~2026-05-18 12:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-14 16:07 [PATCH v2 0/3] Doc, scripts: facilitate phaseout of strlcat Manuel Ebner
2026-05-14 16:26 ` [PATCH v2 1/3] Doc: deprecated.rst: add strlcat() Manuel Ebner
2026-05-14 16:31 ` Kees Cook
2026-05-14 17:51 ` Randy Dunlap
2026-05-16 15:28 ` Heiko Carstens
2026-05-16 16:35 ` David Laight
2026-05-18 7:11 ` Geert Uytterhoeven
2026-05-18 12:59 ` David Laight [this message]
2026-05-14 16:28 ` [PATCH v2 2/3] scripts: checkpatch.pl: add warning for strlcat() Manuel Ebner
2026-05-14 16:32 ` Kees Cook
2026-05-14 16:30 ` [PATCH v2 3/3] drivers: add deprecated remarks to strlcat() Manuel Ebner
2026-05-15 6:59 ` Andy Shevchenko
2026-05-15 7:22 ` Geert Uytterhoeven
2026-05-15 7:30 ` Andy Shevchenko
2026-05-15 7:31 ` Andy Shevchenko
2026-05-15 7:32 ` Geert Uytterhoeven
2026-05-15 9:31 ` David Laight
2026-05-15 9:41 ` Geert Uytterhoeven
2026-05-19 14:10 ` [PATCH v2 0/3] Doc, scripts: facilitate phaseout of strlcat Manuel Ebner
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=20260518135926.0a916782@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=andy.shevchenko@gmail.com \
--cc=apw@canonical.com \
--cc=corbet@lwn.net \
--cc=dwaipayanray1@gmail.com \
--cc=geert@linux-m68k.org \
--cc=hca@linux.ibm.com \
--cc=jani.nikula@intel.com \
--cc=joe@perches.com \
--cc=kees@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@gmail.com \
--cc=manuelebner@mailbox.org \
--cc=rdunlap@infradead.org \
--cc=skhan@linuxfoundation.org \
--cc=workflows@vger.kernel.org \
/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