From: Tejun Heo <tj@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: driver-core@lists.linux.dev, linux-kernel@vger.kernel.org,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>, NeilBrown <neil@brown.name>
Subject: Re: [PATCH] sysfs: clamp show() return value in sysfs_kf_read()
Date: Thu, 21 May 2026 06:18:09 -1000 [thread overview]
Message-ID: <ag8wQfilndx2CtX-@slm.duckdns.org> (raw)
In-Reply-To: <2026052129-mustard-sepia-5cd6@gregkh>
Hello,
On Thu, May 21, 2026 at 08:18:32AM +0200, Greg Kroah-Hartman wrote:
> On Wed, May 20, 2026 at 08:19:34AM -1000, Tejun Heo wrote:
> > Hello,
> >
> > Two nits:
> >
> > - Buffer is atomic_write_len ?: PAGE_SIZE, so probably better to clamp
> > to that than hardcode PAGE_SIZE.
>
> Where is that check at? And sysfs_kf_seq_show() doesn't check it this
> way, should that change?
In kernfs_fop_open(), if ops->prealloc, we allocate of->prealloc_buf to the
size of of->atomic_write_len ?: PAGE_SIZE. Maybe we should just update
of->atomic_write_len. I think the intention was to allow >PAGE_SIZE atomic
content. seq_file now does dynamic buffer resizing, so this may not be
necessary. There's no clean interface to preemptly set the minimum buffer
size right now but that probably is the better direction. Then, we can just
always go through seq_file.
Thanks.
--
tejun
next prev parent reply other threads:[~2026-05-21 16:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 13:07 Greg Kroah-Hartman
2026-05-20 13:36 ` Rafael J. Wysocki
2026-05-20 14:43 ` Danilo Krummrich
2026-05-20 18:19 ` Tejun Heo
2026-05-21 6:18 ` Greg Kroah-Hartman
2026-05-21 10:04 ` David Laight
2026-05-21 16:18 ` Tejun Heo [this message]
2026-05-21 21:42 ` David Laight
2026-05-20 22:11 ` David Laight
2026-05-21 6:19 ` Greg Kroah-Hartman
2026-05-21 9:17 ` 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=ag8wQfilndx2CtX-@slm.duckdns.org \
--to=tj@kernel.org \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neil@brown.name \
--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
all inboxes | Powered by JetHome®