Hi Denis,

Thanks for your reminding, we have ignored this warning.

Best Regards,
Rong Chen

On 12/29/20 2:41 PM, Denis Efremov wrote:
Hi,

Could you please disable automatic emails based on this rule?
The rule requires an update after sysfs_emit patchset by Joe Perches
was merged.
https://lore.kernel.org/linux-pm/5d606519698ce4c8f1203a2b35797d8254c6050a.1600285923.git....@perches.com/T/

I'll prepare an update for the rule.

Thanks,
Denis


On 12/29/20 7:59 AM, kernel test robot wrote:
CC: [email protected]
CC: [email protected]
TO: Denis Efremov <[email protected]>
CC: Julia Lawall <[email protected]>
CC: "Rafael J. Wysocki" <[email protected]>
CC: Len Brown <[email protected]>
CC: [email protected]
CC: [email protected]

From: kernel test robot <[email protected]>

drivers/acpi/bgrt.c:28:8-16: WARNING: use scnprintf or sprintf
drivers/acpi/bgrt.c:35:8-16: WARNING: use scnprintf or sprintf
drivers/acpi/bgrt.c:21:8-16: WARNING: use scnprintf or sprintf
drivers/acpi/bgrt.c:42:8-16: WARNING: use scnprintf or sprintf
drivers/acpi/bgrt.c:49:8-16: WARNING: use scnprintf or sprintf


  From Documentation/filesystems/sysfs.txt:
   show() must not use snprintf() when formatting the value to be
   returned to user space. If you can guarantee that an overflow
   will never happen you can use sprintf() otherwise you must use
   scnprintf().

Generated by: scripts/coccinelle/api/device_attr_show.cocci

Fixes: abfc19ff202d ("coccinelle: api: add device_attr_show script")
CC: Denis Efremov <[email protected]>
Reported-by: kernel test robot <[email protected]>
Signed-off-by: kernel test robot <[email protected]>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   dea8dcf2a9fa8cc540136a6cd885c3beece16ec3
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add 
device_attr_show script
:::::: branch date: 7 hours ago
:::::: commit date: 5 months ago

Please take the patch only if it's a positive warning. Thanks!

  bgrt.c |   10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)

--- a/drivers/acpi/bgrt.c
+++ b/drivers/acpi/bgrt.c
@@ -18,35 +18,35 @@ static struct kobject *bgrt_kobj;
  static ssize_t show_version(struct device *dev,
                            struct device_attribute *attr, char *buf)
  {
-       return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.version);
+       return scnprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.version);
  }
  static DEVICE_ATTR(version, S_IRUGO, show_version, NULL);
static ssize_t show_status(struct device *dev,
                           struct device_attribute *attr, char *buf)
  {
-       return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.status);
+       return scnprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.status);
  }
  static DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
static ssize_t show_type(struct device *dev,
                         struct device_attribute *attr, char *buf)
  {
-       return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_type);
+       return scnprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_type);
  }
  static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
static ssize_t show_xoffset(struct device *dev,
                            struct device_attribute *attr, char *buf)
  {
-       return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_offset_x);
+       return scnprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_offset_x);
  }
  static DEVICE_ATTR(xoffset, S_IRUGO, show_xoffset, NULL);
static ssize_t show_yoffset(struct device *dev,
                            struct device_attribute *attr, char *buf)
  {
-       return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_offset_y);
+       return scnprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_offset_y);
  }
  static DEVICE_ATTR(yoffset, S_IRUGO, show_yoffset, NULL);
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to