From: Kees Cook <kees@kernel.org>
To: David Laight <david.laight.linux@gmail.com>
Cc: Alejandro Colomar <alx+linux-hardening@kernel.org>,
Mariia Nikitash <nikitash.mariiaw@gmail.com>,
hverkuil@kernel.org, mchehab@kernel.org,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org, justinstitt@google.com,
morbo@google.com
Subject: Re: [PATCH] media: radio: Replace strlcat() with seq_buf in TEA drivers
Date: Thu, 12 Nov 2026 12:31:06 -0800 [thread overview]
Message-ID: <202611121228.D57E624119@keescook> (raw)
In-Reply-To: <20261112190702.480740d2@pumpkin>
On Thu, Nov 12, 2026 at 07:07:02PM +0000, David Laight wrote:
> But both snprintf() and seq_buf are far more expensive than doing the
> strlen().
> There is the separate issue that strlcpy() manages to needlessly inline a
> strnlen() in a lot of the call sites - instead of deferring it to the
> helper function.
Right, my driving goal here isn't about performance, it's about
correctness (as much as possible given our giant codebase). We don't
need the most perfect fast implementation if it's too easy to shoot our
feet. strlcat() requires an external bounds that has no strict tie to
the destination argument, and it has no bounds information at all for
the source argument.
If we're in fast-path, we have a different set of criteria. And seq_buf
was actually designed for that, as it trades storage for speed: it keeps
the needed offsets in memory, but that makes it fast for stuff like
perf.
--
Kees Cook
next prev parent reply other threads:[~2026-11-12 20:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 7:46 Mariia Nikitash
2026-11-06 10:39 ` Alejandro Colomar
2026-11-07 4:31 ` Mariia Nikitash
2026-11-07 7:39 ` Alejandro Colomar
2026-11-08 21:02 ` David Laight
2026-11-08 21:25 ` Alejandro Colomar
2026-11-12 17:54 ` Kees Cook
2026-11-12 19:07 ` David Laight
2026-11-12 20:31 ` Kees Cook [this message]
2026-11-12 22:07 ` Alejandro Colomar
2026-11-10 10:08 ` Hans Verkuil
2026-11-10 13:54 ` David Laight
2026-11-10 18:41 ` Mariia Nikitash
2026-11-10 20:58 ` 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=202611121228.D57E624119@keescook \
--to=kees@kernel.org \
--cc=alx+linux-hardening@kernel.org \
--cc=david.laight.linux@gmail.com \
--cc=hverkuil@kernel.org \
--cc=justinstitt@google.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=morbo@google.com \
--cc=nikitash.mariiaw@gmail.com \
/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
all inboxes | Powered by JetHome®