linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/video/fbdev/core/fbcon.c:3509:8-16: WARNING: use scnprintf or sprintf
@ 2020-08-10  9:20 kernel test robot
  2020-08-10  9:21 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
  0 siblings, 1 reply; 12+ messages in thread
From: kernel test robot @ 2020-08-10  9:20 UTC (permalink / raw)
  To: Denis Efremov; +Cc: kbuild-all, linux-kernel, Julia Lawall

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   fc80c51fd4b23ec007e88d4c688f2cac1b8648e7
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script
date:   6 days ago
config: parisc-randconfig-c003-20200810 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0

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


coccinelle warnings: (new ones prefixed by >>)

>> drivers/video/fbdev/core/fbcon.c:3509:8-16: WARNING: use scnprintf or sprintf
   drivers/video/fbdev/core/fbcon.c:3484:8-16: WARNING: use scnprintf or sprintf
--
>> drivers/tty/vt/vt.c:3820:8-16: WARNING: use scnprintf or sprintf
   drivers/tty/vt/vt.c:3828: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@lists.01.org

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

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

* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
  2020-08-10  9:20 drivers/video/fbdev/core/fbcon.c:3509:8-16: WARNING: use scnprintf or sprintf kernel test robot
@ 2020-08-10  9:21 ` kernel test robot
  2020-09-08 11:37   ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 12+ messages in thread
From: kernel test robot @ 2020-08-10  9:21 UTC (permalink / raw)
  To: Denis Efremov
  Cc: kbuild-all, linux-kernel, Julia Lawall,
	Bartlomiej Zolnierkiewicz, Daniel Vetter, Nathan Chancellor,
	Sam Ravnborg, Alex Deucher, Qiujun Huang, Peter Rosin, dri-devel

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

drivers/video/fbdev/core/fbcon.c:3509:8-16: WARNING: use scnprintf or sprintf
drivers/video/fbdev/core/fbcon.c:3484: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:   fc80c51fd4b23ec007e88d4c688f2cac1b8648e7
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script

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

 fbcon.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -3481,7 +3481,7 @@ static ssize_t show_rotate(struct device
 	rotate = fbcon_get_rotate(info);
 err:
 	console_unlock();
-	return snprintf(buf, PAGE_SIZE, "%d\n", rotate);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", rotate);
 }
 
 static ssize_t show_cursor_blink(struct device *device,
@@ -3506,7 +3506,7 @@ static ssize_t show_cursor_blink(struct
 	blink = (ops->flags & FBCON_FLAGS_CURSOR_TIMER) ? 1 : 0;
 err:
 	console_unlock();
-	return snprintf(buf, PAGE_SIZE, "%d\n", blink);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", blink);
 }
 
 static ssize_t store_cursor_blink(struct device *device,

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

* Re: [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
  2020-08-10  9:21 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
@ 2020-09-08 11:37   ` Bartlomiej Zolnierkiewicz
  2020-09-08 12:08     ` [kbuild-all] " Julia Lawall
  0 siblings, 1 reply; 12+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2020-09-08 11:37 UTC (permalink / raw)
  To: kernel test robot
  Cc: Denis Efremov, kbuild-all, linux-kernel, Julia Lawall,
	Daniel Vetter, Nathan Chancellor, Sam Ravnborg, Alex Deucher,
	Qiujun Huang, Peter Rosin, dri-devel


Hi,

On 8/10/20 11:21 AM, kernel test robot wrote:
> From: kernel test robot <lkp@intel.com>
> 
> drivers/video/fbdev/core/fbcon.c:3509:8-16: WARNING: use scnprintf or sprintf
> drivers/video/fbdev/core/fbcon.c:3484: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:   fc80c51fd4b23ec007e88d4c688f2cac1b8648e7
> commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script
> 
> Please take the patch only if it's a positive warning. Thanks!
> 
>  fbcon.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -3481,7 +3481,7 @@ static ssize_t show_rotate(struct device
>  	rotate = fbcon_get_rotate(info);
>  err:
>  	console_unlock();
> -	return snprintf(buf, PAGE_SIZE, "%d\n", rotate);
> +	return scnprintf(buf, PAGE_SIZE, "%d\n", rotate);

buf length is at least PAGE_SIZE and rotate val is an int so
shouldn't this be converted to use sprintf() instead?

>  }
>  
>  static ssize_t show_cursor_blink(struct device *device,
> @@ -3506,7 +3506,7 @@ static ssize_t show_cursor_blink(struct
>  	blink = (ops->flags & FBCON_FLAGS_CURSOR_TIMER) ? 1 : 0;
>  err:
>  	console_unlock();
> -	return snprintf(buf, PAGE_SIZE, "%d\n", blink);
> +	return scnprintf(buf, PAGE_SIZE, "%d\n", blink);

ditto for blink val

>  }
>  
>  static ssize_t store_cursor_blink(struct device *device,
> 
 
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

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

* Re: [kbuild-all] Re: [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
  2020-09-08 11:37   ` Bartlomiej Zolnierkiewicz
@ 2020-09-08 12:08     ` Julia Lawall
  0 siblings, 0 replies; 12+ messages in thread
From: Julia Lawall @ 2020-09-08 12:08 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz
  Cc: kernel test robot, Denis Efremov, kbuild-all, linux-kernel,
	Daniel Vetter, Nathan Chancellor, Sam Ravnborg, Alex Deucher,
	Qiujun Huang, Peter Rosin, dri-devel



On Tue, 8 Sep 2020, Bartlomiej Zolnierkiewicz wrote:

>
> Hi,
>
> On 8/10/20 11:21 AM, kernel test robot wrote:
> > From: kernel test robot <lkp@intel.com>
> >
> > drivers/video/fbdev/core/fbcon.c:3509:8-16: WARNING: use scnprintf or sprintf
> > drivers/video/fbdev/core/fbcon.c:3484: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:   fc80c51fd4b23ec007e88d4c688f2cac1b8648e7
> > commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script
> >
> > Please take the patch only if it's a positive warning. Thanks!
> >
> >  fbcon.c |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > --- a/drivers/video/fbdev/core/fbcon.c
> > +++ b/drivers/video/fbdev/core/fbcon.c
> > @@ -3481,7 +3481,7 @@ static ssize_t show_rotate(struct device
> >  	rotate = fbcon_get_rotate(info);
> >  err:
> >  	console_unlock();
> > -	return snprintf(buf, PAGE_SIZE, "%d\n", rotate);
> > +	return scnprintf(buf, PAGE_SIZE, "%d\n", rotate);
>
> buf length is at least PAGE_SIZE and rotate val is an int so
> shouldn't this be converted to use sprintf() instead?

The rule is evolving in this direction.  Thanks for the feedback.

julia

>
> >  }
> >
> >  static ssize_t show_cursor_blink(struct device *device,
> > @@ -3506,7 +3506,7 @@ static ssize_t show_cursor_blink(struct
> >  	blink = (ops->flags & FBCON_FLAGS_CURSOR_TIMER) ? 1 : 0;
> >  err:
> >  	console_unlock();
> > -	return snprintf(buf, PAGE_SIZE, "%d\n", blink);
> > +	return scnprintf(buf, PAGE_SIZE, "%d\n", blink);
>
> ditto for blink val
>
> >  }
> >
> >  static ssize_t store_cursor_blink(struct device *device,
> >
>
> Best regards,
> --
> Bartlomiej Zolnierkiewicz
> Samsung R&D Institute Poland
> Samsung Electronics
> _______________________________________________
> kbuild-all mailing list -- kbuild-all@lists.01.org
> To unsubscribe send an email to kbuild-all-leave@lists.01.org
>

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

* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
  2020-08-13  0:56 drivers/acpi/dock.c:563:8-16: WARNING: use scnprintf or sprintf kernel test robot
                   ` (6 preceding siblings ...)
  2020-08-13  0:56 ` kernel test robot
@ 2020-08-13  0:56 ` kernel test robot
  7 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2020-08-13  0:56 UTC (permalink / raw)
  To: Denis Efremov
  Cc: kbuild-all, linux-kernel, Julia Lawall, Jiri Kosina,
	Benjamin Tissoires, linux-input

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

drivers/hid/hid-sony.c:611:8-16: WARNING: use scnprintf or sprintf
drivers/hid/hid-sony.c:648:8-16: WARNING: use scnprintf or sprintf
drivers/hid/hid-sony.c:660: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:   7c2a69f610e64c8dec6a06a66e721f4ce1dd783a
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script

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

 hid-sony.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -608,7 +608,7 @@ static ssize_t ds4_show_poll_interval(st
 	struct hid_device *hdev = to_hid_device(dev);
 	struct sony_sc *sc = hid_get_drvdata(hdev);
 
-	return snprintf(buf, PAGE_SIZE, "%i\n", sc->ds4_bt_poll_interval);
+	return scnprintf(buf, PAGE_SIZE, "%i\n", sc->ds4_bt_poll_interval);
 }
 
 static ssize_t ds4_store_poll_interval(struct device *dev,
@@ -645,7 +645,7 @@ static ssize_t sony_show_firmware_versio
 	struct hid_device *hdev = to_hid_device(dev);
 	struct sony_sc *sc = hid_get_drvdata(hdev);
 
-	return snprintf(buf, PAGE_SIZE, "0x%04x\n", sc->fw_version);
+	return scnprintf(buf, PAGE_SIZE, "0x%04x\n", sc->fw_version);
 }
 
 static DEVICE_ATTR(firmware_version, 0444, sony_show_firmware_version, NULL);
@@ -657,7 +657,7 @@ static ssize_t sony_show_hardware_versio
 	struct hid_device *hdev = to_hid_device(dev);
 	struct sony_sc *sc = hid_get_drvdata(hdev);
 
-	return snprintf(buf, PAGE_SIZE, "0x%04x\n", sc->hw_version);
+	return scnprintf(buf, PAGE_SIZE, "0x%04x\n", sc->hw_version);
 }
 
 static DEVICE_ATTR(hardware_version, 0444, sony_show_hardware_version, NULL);

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

* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
  2020-08-13  0:56 drivers/acpi/dock.c:563:8-16: WARNING: use scnprintf or sprintf kernel test robot
                   ` (5 preceding siblings ...)
  2020-08-13  0:56 ` kernel test robot
@ 2020-08-13  0:56 ` kernel test robot
  2020-08-13  0:56 ` kernel test robot
  7 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2020-08-13  0:56 UTC (permalink / raw)
  To: Denis Efremov
  Cc: kbuild-all, linux-kernel, Julia Lawall, Stefan Achatz,
	Jiri Kosina, Benjamin Tissoires, linux-input

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

drivers/hid/hid-roccat-pyra.c:289:8-16: WARNING: use scnprintf or sprintf
drivers/hid/hid-roccat-pyra.c:306:8-16: WARNING: use scnprintf or sprintf
drivers/hid/hid-roccat-pyra.c:327: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:   7c2a69f610e64c8dec6a06a66e721f4ce1dd783a
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script

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

 hid-roccat-pyra.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/hid/hid-roccat-pyra.c
+++ b/drivers/hid/hid-roccat-pyra.c
@@ -286,7 +286,7 @@ static ssize_t pyra_sysfs_show_actual_cp
 {
 	struct pyra_device *pyra =
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
-	return snprintf(buf, PAGE_SIZE, "%d\n", pyra->actual_cpi);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", pyra->actual_cpi);
 }
 static DEVICE_ATTR(actual_cpi, 0440, pyra_sysfs_show_actual_cpi, NULL);
 
@@ -303,7 +303,7 @@ static ssize_t pyra_sysfs_show_actual_pr
 			&settings, PYRA_SIZE_SETTINGS);
 	mutex_unlock(&pyra->pyra_lock);
 
-	return snprintf(buf, PAGE_SIZE, "%d\n", settings.startup_profile);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", settings.startup_profile);
 }
 static DEVICE_ATTR(actual_profile, 0440, pyra_sysfs_show_actual_profile, NULL);
 static DEVICE_ATTR(startup_profile, 0440, pyra_sysfs_show_actual_profile, NULL);
@@ -324,7 +324,7 @@ static ssize_t pyra_sysfs_show_firmware_
 			&info, PYRA_SIZE_INFO);
 	mutex_unlock(&pyra->pyra_lock);
 
-	return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version);
 }
 static DEVICE_ATTR(firmware_version, 0440, pyra_sysfs_show_firmware_version,
 		   NULL);

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

* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
  2020-08-13  0:56 drivers/acpi/dock.c:563:8-16: WARNING: use scnprintf or sprintf kernel test robot
                   ` (4 preceding siblings ...)
  2020-08-13  0:56 ` kernel test robot
@ 2020-08-13  0:56 ` kernel test robot
  2020-08-13  0:56 ` kernel test robot
  2020-08-13  0:56 ` kernel test robot
  7 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2020-08-13  0:56 UTC (permalink / raw)
  To: Denis Efremov
  Cc: kbuild-all, linux-kernel, Julia Lawall, Stefan Achatz,
	Jiri Kosina, Benjamin Tissoires, linux-input

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

drivers/hid/hid-roccat-kovaplus.c:330:8-16: WARNING: use scnprintf or sprintf
drivers/hid/hid-roccat-kovaplus.c:277:8-16: WARNING: use scnprintf or sprintf
drivers/hid/hid-roccat-kovaplus.c:339:8-16: WARNING: use scnprintf or sprintf
drivers/hid/hid-roccat-kovaplus.c:349:8-16: WARNING: use scnprintf or sprintf
drivers/hid/hid-roccat-kovaplus.c:370: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:   7c2a69f610e64c8dec6a06a66e721f4ce1dd783a
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script

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

 hid-roccat-kovaplus.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--- a/drivers/hid/hid-roccat-kovaplus.c
+++ b/drivers/hid/hid-roccat-kovaplus.c
@@ -274,7 +274,7 @@ static ssize_t kovaplus_sysfs_show_actua
 {
 	struct kovaplus_device *kovaplus =
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
-	return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_profile);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_profile);
 }
 
 static ssize_t kovaplus_sysfs_set_actual_profile(struct device *dev,
@@ -327,7 +327,7 @@ static ssize_t kovaplus_sysfs_show_actua
 {
 	struct kovaplus_device *kovaplus =
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
-	return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_cpi);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_cpi);
 }
 static DEVICE_ATTR(actual_cpi, 0440, kovaplus_sysfs_show_actual_cpi, NULL);
 
@@ -336,7 +336,7 @@ static ssize_t kovaplus_sysfs_show_actua
 {
 	struct kovaplus_device *kovaplus =
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
-	return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_x_sensitivity);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_x_sensitivity);
 }
 static DEVICE_ATTR(actual_sensitivity_x, 0440,
 		   kovaplus_sysfs_show_actual_sensitivity_x, NULL);
@@ -346,7 +346,7 @@ static ssize_t kovaplus_sysfs_show_actua
 {
 	struct kovaplus_device *kovaplus =
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
-	return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_y_sensitivity);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_y_sensitivity);
 }
 static DEVICE_ATTR(actual_sensitivity_y, 0440,
 		   kovaplus_sysfs_show_actual_sensitivity_y, NULL);
@@ -367,7 +367,7 @@ static ssize_t kovaplus_sysfs_show_firmw
 			&info, KOVAPLUS_SIZE_INFO);
 	mutex_unlock(&kovaplus->kovaplus_lock);
 
-	return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version);
 }
 static DEVICE_ATTR(firmware_version, 0440,
 		   kovaplus_sysfs_show_firmware_version, NULL);

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

* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
  2020-08-13  0:56 drivers/acpi/dock.c:563:8-16: WARNING: use scnprintf or sprintf kernel test robot
                   ` (3 preceding siblings ...)
  2020-08-13  0:56 ` kernel test robot
@ 2020-08-13  0:56 ` kernel test robot
  2020-08-13  0:56 ` kernel test robot
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2020-08-13  0:56 UTC (permalink / raw)
  To: Denis Efremov
  Cc: kbuild-all, linux-kernel, Julia Lawall, Stefan Achatz,
	Jiri Kosina, Benjamin Tissoires, linux-input

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

drivers/hid/hid-roccat-koneplus.c:247:8-16: WARNING: use scnprintf or sprintf
drivers/hid/hid-roccat-koneplus.c:314: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:   7c2a69f610e64c8dec6a06a66e721f4ce1dd783a
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script

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

 hid-roccat-koneplus.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/hid/hid-roccat-koneplus.c
+++ b/drivers/hid/hid-roccat-koneplus.c
@@ -244,7 +244,7 @@ static ssize_t koneplus_sysfs_show_actua
 {
 	struct koneplus_device *koneplus =
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
-	return snprintf(buf, PAGE_SIZE, "%d\n", koneplus->actual_profile);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", koneplus->actual_profile);
 }
 
 static ssize_t koneplus_sysfs_set_actual_profile(struct device *dev,
@@ -311,7 +311,7 @@ static ssize_t koneplus_sysfs_show_firmw
 			&info, KONEPLUS_SIZE_INFO);
 	mutex_unlock(&koneplus->koneplus_lock);
 
-	return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version);
 }
 static DEVICE_ATTR(firmware_version, 0440,
 		   koneplus_sysfs_show_firmware_version, NULL);

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

* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
  2020-08-13  0:56 drivers/acpi/dock.c:563:8-16: WARNING: use scnprintf or sprintf kernel test robot
                   ` (2 preceding siblings ...)
  2020-08-13  0:56 ` kernel test robot
@ 2020-08-13  0:56 ` kernel test robot
  2020-08-13  0:56 ` kernel test robot
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2020-08-13  0:56 UTC (permalink / raw)
  To: Denis Efremov
  Cc: kbuild-all, linux-kernel, Julia Lawall, Stefan Achatz,
	Jiri Kosina, Benjamin Tissoires, linux-input

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

drivers/hid/hid-roccat-kone.c:406:8-16: WARNING: use scnprintf or sprintf
drivers/hid/hid-roccat-kone.c:397:8-16: WARNING: use scnprintf or sprintf
drivers/hid/hid-roccat-kone.c:438:8-16: WARNING: use scnprintf or sprintf
drivers/hid/hid-roccat-kone.c:550:8-16: WARNING: use scnprintf or sprintf
drivers/hid/hid-roccat-kone.c:448:8-16: WARNING: use scnprintf or sprintf
drivers/hid/hid-roccat-kone.c:429: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:   7c2a69f610e64c8dec6a06a66e721f4ce1dd783a
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script

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

 hid-roccat-kone.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- a/drivers/hid/hid-roccat-kone.c
+++ b/drivers/hid/hid-roccat-kone.c
@@ -394,7 +394,7 @@ static ssize_t kone_sysfs_show_actual_pr
 {
 	struct kone_device *kone =
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
-	return snprintf(buf, PAGE_SIZE, "%d\n", kone->actual_profile);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", kone->actual_profile);
 }
 static DEVICE_ATTR(actual_profile, 0440, kone_sysfs_show_actual_profile, NULL);
 
@@ -403,7 +403,7 @@ static ssize_t kone_sysfs_show_actual_dp
 {
 	struct kone_device *kone =
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
-	return snprintf(buf, PAGE_SIZE, "%d\n", kone->actual_dpi);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", kone->actual_dpi);
 }
 static DEVICE_ATTR(actual_dpi, 0440, kone_sysfs_show_actual_dpi, NULL);
 
@@ -426,7 +426,7 @@ static ssize_t kone_sysfs_show_weight(st
 
 	if (retval)
 		return retval;
-	return snprintf(buf, PAGE_SIZE, "%d\n", weight);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", weight);
 }
 static DEVICE_ATTR(weight, 0440, kone_sysfs_show_weight, NULL);
 
@@ -435,7 +435,7 @@ static ssize_t kone_sysfs_show_firmware_
 {
 	struct kone_device *kone =
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
-	return snprintf(buf, PAGE_SIZE, "%d\n", kone->firmware_version);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", kone->firmware_version);
 }
 static DEVICE_ATTR(firmware_version, 0440, kone_sysfs_show_firmware_version,
 		   NULL);
@@ -445,7 +445,7 @@ static ssize_t kone_sysfs_show_tcu(struc
 {
 	struct kone_device *kone =
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
-	return snprintf(buf, PAGE_SIZE, "%d\n", kone->settings.tcu);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", kone->settings.tcu);
 }
 
 static int kone_tcu_command(struct usb_device *usb_dev, int number)
@@ -547,7 +547,7 @@ static ssize_t kone_sysfs_show_startup_p
 {
 	struct kone_device *kone =
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
-	return snprintf(buf, PAGE_SIZE, "%d\n", kone->settings.startup_profile);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", kone->settings.startup_profile);
 }
 
 static ssize_t kone_sysfs_set_startup_profile(struct device *dev,

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

* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
  2020-08-13  0:56 drivers/acpi/dock.c:563:8-16: WARNING: use scnprintf or sprintf kernel test robot
  2020-08-13  0:56 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
  2020-08-13  0:56 ` kernel test robot
@ 2020-08-13  0:56 ` kernel test robot
  2020-08-13  0:56 ` kernel test robot
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2020-08-13  0:56 UTC (permalink / raw)
  To: Denis Efremov
  Cc: kbuild-all, linux-kernel, Julia Lawall, Stefan Achatz,
	Jiri Kosina, Benjamin Tissoires, linux-input

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

drivers/hid/hid-roccat-isku.c:66: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:   7c2a69f610e64c8dec6a06a66e721f4ce1dd783a
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script

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

 hid-roccat-isku.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/hid/hid-roccat-isku.c
+++ b/drivers/hid/hid-roccat-isku.c
@@ -63,7 +63,7 @@ static ssize_t isku_sysfs_show_actual_pr
 {
 	struct isku_device *isku =
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
-	return snprintf(buf, PAGE_SIZE, "%d\n", isku->actual_profile);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", isku->actual_profile);
 }
 
 static ssize_t isku_sysfs_set_actual_profile(struct device *dev,

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

* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
  2020-08-13  0:56 drivers/acpi/dock.c:563:8-16: WARNING: use scnprintf or sprintf kernel test robot
  2020-08-13  0:56 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
@ 2020-08-13  0:56 ` kernel test robot
  2020-08-13  0:56 ` kernel test robot
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2020-08-13  0:56 UTC (permalink / raw)
  To: Denis Efremov
  Cc: kbuild-all, linux-kernel, Julia Lawall, Stefan Achatz,
	Jiri Kosina, Benjamin Tissoires, linux-input

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

drivers/hid/hid-roccat-arvo.c:149:8-16: WARNING: use scnprintf or sprintf
drivers/hid/hid-roccat-arvo.c:95:8-16: WARNING: use scnprintf or sprintf
drivers/hid/hid-roccat-arvo.c:45: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:   7c2a69f610e64c8dec6a06a66e721f4ce1dd783a
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script

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

 hid-roccat-arvo.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/hid/hid-roccat-arvo.c
+++ b/drivers/hid/hid-roccat-arvo.c
@@ -42,7 +42,7 @@ static ssize_t arvo_sysfs_show_mode_key(
 	if (retval)
 		return retval;
 
-	return snprintf(buf, PAGE_SIZE, "%d\n", temp_buf.state);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", temp_buf.state);
 }
 
 static ssize_t arvo_sysfs_set_mode_key(struct device *dev,
@@ -92,7 +92,7 @@ static ssize_t arvo_sysfs_show_key_mask(
 	if (retval)
 		return retval;
 
-	return snprintf(buf, PAGE_SIZE, "%d\n", temp_buf.key_mask);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", temp_buf.key_mask);
 }
 
 static ssize_t arvo_sysfs_set_key_mask(struct device *dev,
@@ -146,7 +146,7 @@ static ssize_t arvo_sysfs_show_actual_pr
 	struct arvo_device *arvo =
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
 
-	return snprintf(buf, PAGE_SIZE, "%d\n", arvo->actual_profile);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", arvo->actual_profile);
 }
 
 static ssize_t arvo_sysfs_set_actual_profile(struct device *dev,

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

* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
  2020-08-13  0:56 drivers/acpi/dock.c:563:8-16: WARNING: use scnprintf or sprintf kernel test robot
@ 2020-08-13  0:56 ` kernel test robot
  2020-08-13  0:56 ` kernel test robot
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2020-08-13  0:56 UTC (permalink / raw)
  To: Denis Efremov
  Cc: kbuild-all, linux-kernel, Julia Lawall, Rafael J. Wysocki,
	Len Brown, linux-acpi

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

drivers/acpi/dock.c:563:8-16: WARNING: use scnprintf or sprintf
drivers/acpi/dock.c:544:8-16: WARNING: use scnprintf or sprintf
drivers/acpi/dock.c:495:8-16: WARNING: use scnprintf or sprintf
drivers/acpi/dock.c:506: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:   7c2a69f610e64c8dec6a06a66e721f4ce1dd783a
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script

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

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

--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -492,7 +492,7 @@ static ssize_t show_docked(struct device
 	struct acpi_device *adev = NULL;
 
 	acpi_bus_get_device(dock_station->handle, &adev);
-	return snprintf(buf, PAGE_SIZE, "%u\n", acpi_device_enumerated(adev));
+	return scnprintf(buf, PAGE_SIZE, "%u\n", acpi_device_enumerated(adev));
 }
 static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL);
 
@@ -503,7 +503,7 @@ static ssize_t show_flags(struct device
 			  struct device_attribute *attr, char *buf)
 {
 	struct dock_station *dock_station = dev->platform_data;
-	return snprintf(buf, PAGE_SIZE, "%d\n", dock_station->flags);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", dock_station->flags);
 
 }
 static DEVICE_ATTR(flags, S_IRUGO, show_flags, NULL);
@@ -541,7 +541,7 @@ static ssize_t show_dock_uid(struct devi
 	if (ACPI_FAILURE(status))
 	    return 0;
 
-	return snprintf(buf, PAGE_SIZE, "%llx\n", lbuf);
+	return scnprintf(buf, PAGE_SIZE, "%llx\n", lbuf);
 }
 static DEVICE_ATTR(uid, S_IRUGO, show_dock_uid, NULL);
 
@@ -560,7 +560,7 @@ static ssize_t show_dock_type(struct dev
 	else
 		type = "unknown";
 
-	return snprintf(buf, PAGE_SIZE, "%s\n", type);
+	return scnprintf(buf, PAGE_SIZE, "%s\n", type);
 }
 static DEVICE_ATTR(type, S_IRUGO, show_dock_type, NULL);
 

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

end of thread, other threads:[~2020-09-08 19:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10  9:20 drivers/video/fbdev/core/fbcon.c:3509:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-08-10  9:21 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-09-08 11:37   ` Bartlomiej Zolnierkiewicz
2020-09-08 12:08     ` [kbuild-all] " Julia Lawall
2020-08-13  0:56 drivers/acpi/dock.c:563:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-08-13  0:56 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-08-13  0:56 ` kernel test robot
2020-08-13  0:56 ` kernel test robot
2020-08-13  0:56 ` kernel test robot
2020-08-13  0:56 ` kernel test robot
2020-08-13  0:56 ` kernel test robot
2020-08-13  0:56 ` kernel test robot
2020-08-13  0:56 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).