From: Ben Dooks <ben.dooks@codethink.co.uk>
To: nvdimm@lists.linux.dev
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
lenb@kernel.org
Subject: Re: [PATCH] ACPI: NFIT: limit string attribute write
Date: Tue, 11 Jul 2023 10:36:49 +0100 [thread overview]
Message-ID: <a066097a-b02e-eee0-c57a-27dd7fbe6989@codethink.co.uk> (raw)
In-Reply-To: <20230711092244.22527-1-ben.dooks@codethink.co.uk>
On 11/07/2023 10:22, Ben Dooks wrote:
> If we're writing what could be an arbitrary sized string into an attribute
> we should probably use sysfs_emit() just to be safe. Most of the other
> attriubtes are some sort of integer so unlikely to be an issue so not
> altered at this time.
>
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
> v2:
> - use sysfs_emit() instead of snprintf.
> ---
> drivers/acpi/nfit/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
> index 9213b426b125..d7e9d9cd16d2 100644
> --- a/drivers/acpi/nfit/core.c
> +++ b/drivers/acpi/nfit/core.c
> @@ -1579,7 +1579,7 @@ static ssize_t id_show(struct device *dev,
> {
> struct nfit_mem *nfit_mem = to_nfit_mem(dev);
>
> - return sprintf(buf, "%s\n", nfit_mem->id);
> + return snprintf(buf, PAGE_SIZE, "%s\n", nfit_mem->id);
> }
> static DEVICE_ATTR_RO(id);
>
whoops, forgot to add before hitting ammend...
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
https://www.codethink.co.uk/privacy.html
next prev parent reply other threads:[~2023-07-11 9:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 9:22 Ben Dooks
2023-07-11 9:36 ` Ben Dooks [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-07-04 8:17 Ben Dooks
2023-07-05 18:34 ` Dave Jiang
2023-07-11 8:36 ` Ben Dooks
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=a066097a-b02e-eee0-c57a-27dd7fbe6989@codethink.co.uk \
--to=ben.dooks@codethink.co.uk \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
/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®