[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2859fb82-1579-4d45-a8ee-2e3de184fa0d@suswa.mountain>
Date: Wed, 18 Jun 2025 18:51:42 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: "Luck, Tony" <tony.luck@...el.com>
Cc: Zaid Alali <zaidal@...amperecomputing.com>, rafael@...nel.org,
lenb@...nel.org, james.morse@....com, bp@...en8.de, kees@...nel.org,
gustavoars@...nel.org, Jonathan.Cameron@...wei.com,
sudeep.holla@....com, jonathanh@...dia.com,
u.kleine-koenig@...libre.com, viro@...iv.linux.org.uk,
ira.weiny@...el.com, alison.schofield@...el.com,
dan.j.williams@...el.com, gregkh@...uxfoundation.org,
peterz@...radead.org, dave.jiang@...el.com,
Benjamin.Cheatham@....com, linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v9 5/7] ACPI: APEI: EINJ: Create debugfs files to enter
device id and syndrome
On Wed, Jun 18, 2025 at 08:30:10AM -0700, Luck, Tony wrote:
> On Wed, Jun 18, 2025 at 06:21:39PM +0300, Dan Carpenter wrote:
> > On Thu, Jun 12, 2025 at 04:13:25PM -0700, Zaid Alali wrote:
> > > +static ssize_t u128_read(struct file *f, char __user *buf, size_t count, loff_t *off)
> > > +{
> > > + char output[2 * COMPONENT_LEN + 1];
> > > + u8 *data = f->f_inode->i_private;
> > > + int i;
> > > +
> > > + if (*off >= sizeof(output))
> > > + return 0;
> >
> > No need for this check. simple_read_from_buffer() will do the
> > right thing.
>
> True. But why waste cycles populating the output buffer
> when it will be ignored? The normal flow here is that
> a user will likely try to read a <stdio.h> sized buffer
> and get back 33 bytes. Then read again to find EOF. That
> second read doesn't need to do all the "sprintf()"s.
>
Ah. Okay, I didn't realize that.
regards,
dan carpenter
Powered by blists - more mailing lists