All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/platform/x86/lg-laptop.c:496:8-16: WARNING: use scnprintf or sprintf
@ 2020-10-06  7:21 kernel test robot
  2020-10-06  7:21 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
  2020-10-06  7:21 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: kernel test robot @ 2020-10-06  7:21 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1696 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:   7575fdda569b2a2e8be32c1a64ecb05d6f96a500
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script
date:   9 weeks ago
:::::: branch date: 12 hours ago
:::::: commit date: 9 weeks ago
config: x86_64-randconfig-c002-20201005 (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>

	echo
	echo "coccinelle warnings: (new ones prefixed by >>)"
	echo
>> drivers/platform/x86/lg-laptop.c:496:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/lg-laptop.c:322:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/lg-laptop.c:447:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/lg-laptop.c:406:8-16: WARNING: use scnprintf or sprintf
   drivers/platform/x86/lg-laptop.c:364:8-16: WARNING: use scnprintf or sprintf
--
>> drivers/video/fbdev/udlfb.c:1436:8-16: WARNING: use scnprintf or sprintf
   drivers/video/fbdev/udlfb.c:1428:8-16: WARNING: use scnprintf or sprintf
   drivers/video/fbdev/udlfb.c:1444:8-16: WARNING: use scnprintf or sprintf
   drivers/video/fbdev/udlfb.c:1452: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: 32060 bytes --]

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

* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
  2020-10-06  7:21 drivers/platform/x86/lg-laptop.c:496:8-16: WARNING: use scnprintf or sprintf kernel test robot
  2020-10-06  7:21 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
@ 2020-10-06  7:21 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2020-10-06  7:21 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 3157 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: "Matan Ziv-Av" <matan@svgalib.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/lg-laptop.c:496:8-16: WARNING: use scnprintf or sprintf
drivers/platform/x86/lg-laptop.c:322:8-16: WARNING: use scnprintf or sprintf
drivers/platform/x86/lg-laptop.c:447:8-16: WARNING: use scnprintf or sprintf
drivers/platform/x86/lg-laptop.c:406:8-16: WARNING: use scnprintf or sprintf
drivers/platform/x86/lg-laptop.c:364: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>
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   7575fdda569b2a2e8be32c1a64ecb05d6f96a500
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script
:::::: branch date: 12 hours ago
:::::: commit date: 9 weeks ago

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

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

--- a/drivers/platform/x86/lg-laptop.c
+++ b/drivers/platform/x86/lg-laptop.c
@@ -319,7 +319,7 @@ static ssize_t fan_mode_show(struct devi
 	status = r->integer.value & 0x01;
 	kfree(r);
 
-	return snprintf(buffer, PAGE_SIZE, "%d\n", status);
+	return scnprintf(buffer, PAGE_SIZE, "%d\n", status);
 }
 
 static ssize_t usb_charge_store(struct device *dev,
@@ -361,7 +361,7 @@ static ssize_t usb_charge_show(struct de
 
 	kfree(r);
 
-	return snprintf(buffer, PAGE_SIZE, "%d\n", status);
+	return scnprintf(buffer, PAGE_SIZE, "%d\n", status);
 }
 
 static ssize_t reader_mode_store(struct device *dev,
@@ -403,7 +403,7 @@ static ssize_t reader_mode_show(struct d
 
 	kfree(r);
 
-	return snprintf(buffer, PAGE_SIZE, "%d\n", status);
+	return scnprintf(buffer, PAGE_SIZE, "%d\n", status);
 }
 
 static ssize_t fn_lock_store(struct device *dev,
@@ -444,7 +444,7 @@ static ssize_t fn_lock_show(struct devic
 	status = !!r->buffer.pointer[0];
 	kfree(r);
 
-	return snprintf(buffer, PAGE_SIZE, "%d\n", status);
+	return scnprintf(buffer, PAGE_SIZE, "%d\n", status);
 }
 
 static ssize_t battery_care_limit_store(struct device *dev,
@@ -493,7 +493,7 @@ static ssize_t battery_care_limit_show(s
 	if (status != 80 && status != 100)
 		status = 0;
 
-	return snprintf(buffer, PAGE_SIZE, "%d\n", status);
+	return scnprintf(buffer, PAGE_SIZE, "%d\n", status);
 }
 
 static DEVICE_ATTR_RW(fan_mode);

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

* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
  2020-10-06  7:21 drivers/platform/x86/lg-laptop.c:496:8-16: WARNING: use scnprintf or sprintf kernel test robot
@ 2020-10-06  7:21 ` kernel test robot
  2020-10-06  7:21 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2020-10-06  7:21 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 3079 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: Bernie Thompson <bernie@plugable.com>
CC: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
CC: linux-fbdev(a)vger.kernel.org
CC: dri-devel(a)lists.freedesktop.org
CC: linux-kernel(a)vger.kernel.org

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

drivers/video/fbdev/udlfb.c:1436:8-16: WARNING: use scnprintf or sprintf
drivers/video/fbdev/udlfb.c:1428:8-16: WARNING: use scnprintf or sprintf
drivers/video/fbdev/udlfb.c:1444:8-16: WARNING: use scnprintf or sprintf
drivers/video/fbdev/udlfb.c:1452: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>
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   7575fdda569b2a2e8be32c1a64ecb05d6f96a500
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script
:::::: branch date: 12 hours ago
:::::: commit date: 9 weeks ago

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

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

--- a/drivers/video/fbdev/udlfb.c
+++ b/drivers/video/fbdev/udlfb.c
@@ -1425,7 +1425,7 @@ static ssize_t metrics_bytes_rendered_sh
 				   struct device_attribute *a, char *buf) {
 	struct fb_info *fb_info = dev_get_drvdata(fbdev);
 	struct dlfb_data *dlfb = fb_info->par;
-	return snprintf(buf, PAGE_SIZE, "%u\n",
+	return scnprintf(buf, PAGE_SIZE, "%u\n",
 			atomic_read(&dlfb->bytes_rendered));
 }
 
@@ -1433,7 +1433,7 @@ static ssize_t metrics_bytes_identical_s
 				   struct device_attribute *a, char *buf) {
 	struct fb_info *fb_info = dev_get_drvdata(fbdev);
 	struct dlfb_data *dlfb = fb_info->par;
-	return snprintf(buf, PAGE_SIZE, "%u\n",
+	return scnprintf(buf, PAGE_SIZE, "%u\n",
 			atomic_read(&dlfb->bytes_identical));
 }
 
@@ -1441,7 +1441,7 @@ static ssize_t metrics_bytes_sent_show(s
 				   struct device_attribute *a, char *buf) {
 	struct fb_info *fb_info = dev_get_drvdata(fbdev);
 	struct dlfb_data *dlfb = fb_info->par;
-	return snprintf(buf, PAGE_SIZE, "%u\n",
+	return scnprintf(buf, PAGE_SIZE, "%u\n",
 			atomic_read(&dlfb->bytes_sent));
 }
 
@@ -1449,7 +1449,7 @@ static ssize_t metrics_cpu_kcycles_used_
 				   struct device_attribute *a, char *buf) {
 	struct fb_info *fb_info = dev_get_drvdata(fbdev);
 	struct dlfb_data *dlfb = fb_info->par;
-	return snprintf(buf, PAGE_SIZE, "%u\n",
+	return scnprintf(buf, PAGE_SIZE, "%u\n",
 			atomic_read(&dlfb->cpu_kcycles_used));
 }
 

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

end of thread, other threads:[~2020-10-06  7:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-06  7:21 drivers/platform/x86/lg-laptop.c:496:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-10-06  7:21 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-10-06  7:21 ` 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.