Re: [RESEND v2] ACPI: NFIT: limit string attribute write

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 7/12/23 05:11, Ben Dooks wrote:
On 12/07/2023 12:57, 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@xxxxxxxxxxxxxxx>
---
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..59c354137627 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 sysfs_emit(buf, "%s\n", nfit_mem->id);
  }
  static DEVICE_ATTR_RO(id);

Should we go through and change all the attribute code to use
sysfs_emit() ?

Probably not a bad idea given they all have the same issue.




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux