From: David Laight <david.laight.linux@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Tejun Heo <tj@kernel.org>,
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 11:04:02 +0100 [thread overview]
Message-ID: <20260521110402.7bc76f4e@pumpkin> (raw)
In-Reply-To: <2026052129-mustard-sepia-5cd6@gregkh>
On Thu, 21 May 2026 08:18:32 +0200
Greg Kroah-Hartman <gregkh@linuxfoundation.org> 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?
It would be better to always fix the 'show' buffer at PAGE_SIZE (or 4k).
The only place that uses is different value is the cgroup code and I
think it needs to support longer writes (100 + 6 * NR_CPUS).
I've not looked at how it handles the matching reads - I presume they exist.
If the data is binary, or it uses seq_printf() then it can just support
a longer dynamically allocated buffer.
-- David
>
> > - pr_warn() instead of bare printk()?
>
> This is copying the message in sysfs_kf_seq_show() that has the same
> exact format. I will send a follow-on patch to make both the same.
>
> thanks,
>
> greg k-h
>
next prev parent reply other threads:[~2026-05-21 10:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 13:07 [PATCH] sysfs: clamp show() return value in sysfs_kf_read() 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 [this message]
2026-05-21 16:18 ` Tejun Heo
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=20260521110402.7bc76f4e@pumpkin \
--to=david.laight.linux@gmail.com \
--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 \
--cc=tj@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