All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/platform/x86/panasonic-laptop.c:371:8-16: WARNING: use scnprintf or sprintf
@ 2020-11-13 17:02 kernel test robot
  2020-11-13 17:02 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2020-11-13 17:02 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 2953 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Denis Efremov <efremov@linux.com>
CC: Julia Lawall <Julia.Lawall@lip6.fr>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   585e5b17b92dead8a3aca4e3c9876fbca5f7e0ba
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script
date:   3 months ago
:::::: branch date: 16 hours ago
:::::: commit date: 3 months ago
config: x86_64-randconfig-c002-20201110 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


"coccinelle warnings: (new ones prefixed by >>)"
>> drivers/platform/x86/panasonic-laptop.c:371:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/panasonic-laptop.c:383:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/panasonic-laptop.c:359:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/panasonic-laptop.c:395:8-16: WARNING: use scnprintf or sprintf
--
>> drivers/platform/x86/thinkpad_acpi.c:3050:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/thinkpad_acpi.c:9876:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/thinkpad_acpi.c:8691:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/thinkpad_acpi.c:8708:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/thinkpad_acpi.c:8572:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/thinkpad_acpi.c:8638:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/thinkpad_acpi.c:2841:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/thinkpad_acpi.c:2830:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/thinkpad_acpi.c:2820:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/thinkpad_acpi.c:2744:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/thinkpad_acpi.c:2772:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/thinkpad_acpi.c:2917:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/thinkpad_acpi.c:2959:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/thinkpad_acpi.c:2852:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/thinkpad_acpi.c:2866:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/thinkpad_acpi.c:2982:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/thinkpad_acpi.c:3015:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/thinkpad_acpi.c:2999:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/thinkpad_acpi.c:6373:8-16: WARNING: use scnprintf or sprintf

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 37058 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
  2020-11-13 17:02 drivers/platform/x86/panasonic-laptop.c:371:8-16: WARNING: use scnprintf or sprintf kernel test robot
@ 2020-11-13 17:02 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2020-11-13 17:02 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 3227 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Denis Efremov <efremov@linux.com>
CC: Julia Lawall <Julia.Lawall@lip6.fr>
CC: Harald Welte <laforge@gnumonks.org>
CC: Darren Hart <dvhart@infradead.org>
CC: Andy Shevchenko <andy@infradead.org>
CC: platform-driver-x86(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org

From: kernel test robot <lkp@intel.com>

drivers/platform/x86/panasonic-laptop.c:371:8-16: WARNING: use scnprintf or sprintf
drivers/platform/x86/panasonic-laptop.c:383:8-16: WARNING: use scnprintf or sprintf
drivers/platform/x86/panasonic-laptop.c:359:8-16: WARNING: use scnprintf or sprintf
drivers/platform/x86/panasonic-laptop.c:395: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 <efremov@linux.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   585e5b17b92dead8a3aca4e3c9876fbca5f7e0ba
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script
:::::: branch date: 16 hours ago
:::::: commit date: 3 months ago

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

 panasonic-laptop.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -356,7 +356,7 @@ static ssize_t show_numbatt(struct devic
 	if (!acpi_pcc_retrieve_biosdata(pcc))
 		return -EIO;
 
-	return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_NUM_BATTERIES]);
+	return scnprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_NUM_BATTERIES]);
 }
 
 static ssize_t show_lcdtype(struct device *dev, struct device_attribute *attr,
@@ -368,7 +368,7 @@ static ssize_t show_lcdtype(struct devic
 	if (!acpi_pcc_retrieve_biosdata(pcc))
 		return -EIO;
 
-	return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_LCD_TYPE]);
+	return scnprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_LCD_TYPE]);
 }
 
 static ssize_t show_mute(struct device *dev, struct device_attribute *attr,
@@ -380,7 +380,7 @@ static ssize_t show_mute(struct device *
 	if (!acpi_pcc_retrieve_biosdata(pcc))
 		return -EIO;
 
-	return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_MUTE]);
+	return scnprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_MUTE]);
 }
 
 static ssize_t show_sticky(struct device *dev, struct device_attribute *attr,
@@ -392,7 +392,7 @@ static ssize_t show_sticky(struct device
 	if (!acpi_pcc_retrieve_biosdata(pcc))
 		return -EIO;
 
-	return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_STICKY_KEY]);
+	return scnprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_STICKY_KEY]);
 }
 
 static ssize_t set_sticky(struct device *dev, struct device_attribute *attr,

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-13 17:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 17:02 drivers/platform/x86/panasonic-laptop.c:371:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-11-13 17:02 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.