From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Kees Cook <kees@kernel.org>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
"Rafael J. Wysocki" <rafael@kernel.org>,
Len Brown <lenb@kernel.org>, Josh Law <objecting@objecting.org>,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH v1 1/1] ACPI: processor: idle: Replace strlcat() with better alternative
Date: Fri, 20 Mar 2026 21:39:33 +0200 [thread overview]
Message-ID: <ab2idYsOFxPfEIYY@ashevche-desk.local> (raw)
In-Reply-To: <202603201230.74BBFFABAD@keescook>
On Fri, Mar 20, 2026 at 12:34:42PM -0700, Kees Cook wrote:
> On Fri, Mar 20, 2026 at 09:25:41PM +0200, Andy Shevchenko wrote:
> > On Fri, Mar 20, 2026 at 12:17:54PM -0700, Kees Cook wrote:
> > > On Mon, Mar 16, 2026 at 06:01:58PM +0100, Andy Shevchenko wrote:
> > > > strlcpy() and strlcat() are confusing APIs and the former one already gone
> > > > from the kernel. In preparation to kill strlcat() replace it with the better
> > > > alternative.
> > >
> > > Yes please. There are a few places I looked at in the past that might
> > > benefit from being changed to seq_buf or similar (where snprintf doesn't
> > > cut it), but otherwise the removal of strlcat should be straight forward
> > > and would be well appreciated. :)
> >
> > Thank you for confirming, this is basically the message to Josh to find
> > users and start converting them and kill strlcat() eventually. Josh, as
> > you see it will be well appreciated!
>
> As an example of a seq_buf user, see block/partitions/core.c:
>
> static struct parsed_partitions *check_partition(struct gendisk *hd)
> {
> ...
> state->pp_buf = (char *)__get_free_page(GFP_KERNEL);
> ...
> state->pp_buf[0] = '\0';
> ...
> snprintf(state->pp_buf, PAGE_SIZE, " %s:", state->name);
> ...
> while (!res && check_part[i]) {
> ...
> res = check_part[i++](state);
> ...
>
> All the partition handlers then use strlcat to append more details,
> and it's totally unbounded. The correct thing would be to build a
> seq_buf to attach to state instead of the pp_buf, and the handlers would
> use seq_buf functions to append their info, etc etc.
Indeed. Thanks for sharing the ideas!
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2026-03-20 19:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-16 17:01 [PATCH v1 1/1] ACPI: processor: idle: Replace strlcat() with better alternative Andy Shevchenko
2026-03-16 18:43 ` Josh Law
2026-03-16 18:47 ` Andy Shevchenko
2026-03-16 18:49 ` Josh Law
2026-03-16 19:42 ` Andy Shevchenko
2026-03-16 19:51 ` Josh Law
2026-03-17 8:17 ` kernel test robot
2026-03-17 8:29 ` Andy Shevchenko
2026-03-20 19:17 ` Kees Cook
2026-03-20 19:25 ` Andy Shevchenko
2026-03-20 19:26 ` Kees Cook
2026-03-20 19:31 ` Josh Law
2026-03-20 19:39 ` Andy Shevchenko
2026-03-20 19:34 ` Kees Cook
2026-03-20 19:39 ` Andy Shevchenko [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=ab2idYsOFxPfEIYY@ashevche-desk.local \
--to=andriy.shevchenko@linux.intel.com \
--cc=kees@kernel.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=objecting@objecting.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@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