From: Randy Dunlap <rdunlap@infradead.org>
To: Kees Cook <kees@kernel.org>, Manuel Ebner <manuelebner@mailbox.org>
Cc: 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>,
Geert Uytterhoeven <geert@linux-m68k.org>,
David Laight <david.laight.linux@gmail.com>,
Jani Nikula <jani.nikula@intel.com>,
Heiko Carstens <hca@linux.ibm.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: Thu, 14 May 2026 10:51:14 -0700 [thread overview]
Message-ID: <eb03a056-374b-4cce-b32d-c1b81f12e549@infradead.org> (raw)
In-Reply-To: <202605140931.913048A68B@keescook>
On 5/14/26 9:31 AM, Kees Cook wrote:
> On Thu, May 14, 2026 at 06:26:53PM +0200, Manuel Ebner wrote:
>> add strlcat and alternatives
>>
>> Signed-off-by: Manuel Ebner <manuelebner@mailbox.org>
>> ---
>> Documentation/process/deprecated.rst | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/Documentation/process/deprecated.rst b/Documentation/process/deprecated.rst
>> index fed56864d036..06e802f4bbfd 100644
>> --- a/Documentation/process/deprecated.rst
>> +++ b/Documentation/process/deprecated.rst
>> @@ -153,6 +153,13 @@ used, and the destinations should be marked with the `__nonstring
>> attribute to avoid future compiler warnings. For cases still needing
>> NUL-padding, strtomem_pad() can be used.
>>
>> +strlcat()
>> +---------
>> +strlcat() must re-scan the destination string from the beginning on each
>> +call (O(n^2) behavior). Alternatives are seq_buf_puts() and seq_buf_printf().
>> +snprintf(), scnprintf() and sysfs_emit() are possible aswell, but the adoption
>> +of the arguments needs to be taken care off.
>> +
>
> How about just:
>
> strlcat() must re-scan the destination string from the beginning on each
> call (O(n^2) behavior). Use the seq_buf API or similar instead.
>
Yeah, that avoids the "aswell" (should be "as well").
>
>> strlcpy()
>> ---------
>> strlcpy() reads the entire source buffer first (since the return value
>> --
>> 2.54.0
>>
>
--
~Randy
next prev parent reply other threads:[~2026-05-14 17:51 UTC|newest]
Thread overview: 7+ 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 [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
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=eb03a056-374b-4cce-b32d-c1b81f12e549@infradead.org \
--to=rdunlap@infradead.org \
--cc=andy.shevchenko@gmail.com \
--cc=apw@canonical.com \
--cc=corbet@lwn.net \
--cc=david.laight.linux@gmail.com \
--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=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