[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3a143d53-8731-4afc-9117-bac49ea96db1@suswa.mountain>
Date: Wed, 18 Jun 2025 18:21:39 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Zaid Alali <zaidal@...amperecomputing.com>
Cc: rafael@...nel.org, lenb@...nel.org, james.morse@....com,
tony.luck@...el.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 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.
regards,
dan carpenter
> +
> + for (i = 0; i < COMPONENT_LEN; i++)
> + sprintf(output + 2 * i, "%.02x", data[COMPONENT_LEN - i - 1]);
> + output[2 * COMPONENT_LEN] = '\n';
> +
> + return simple_read_from_buffer(buf, count, off, output, sizeof(output));
> +}
Powered by blists - more mailing lists