* drivers/acpi/dock.c:563:8-16: WARNING: use scnprintf or sprintf
@ 2020-08-13 0:56 ` kernel test robot
0 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2020-08-13 0:56 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2792 bytes --]
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
date: 8 days ago
config: x86_64-randconfig-c004-20200812 (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>
coccinelle warnings: (new ones prefixed by >>)
>> 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
--
>> 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
--
>> drivers/hid/hid-roccat-isku.c:66:8-16: WARNING: use scnprintf or sprintf
--
>> 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
--
>> 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
--
>> 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
--
>> 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
--
>> 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
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: 30835 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
2020-08-13 0:56 ` kernel test robot
@ 2020-08-13 0:56 ` kernel test robot
-1 siblings, 0 replies; 18+ 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] 18+ messages in thread
* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
@ 2020-08-13 0:56 ` kernel test robot
0 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2020-08-13 0:56 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2497 bytes --]
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] 18+ messages in thread
* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
2020-08-13 0:56 ` kernel test robot
@ 2020-08-13 0:56 ` kernel test robot
-1 siblings, 0 replies; 18+ 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] 18+ messages in thread
* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
@ 2020-08-13 0:56 ` kernel test robot
0 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2020-08-13 0:56 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2152 bytes --]
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] 18+ messages in thread
* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
2020-08-13 0:56 ` kernel test robot
@ 2020-08-13 0:56 ` kernel test robot
-1 siblings, 0 replies; 18+ 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] 18+ messages in thread
* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
@ 2020-08-13 0:56 ` kernel test robot
0 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2020-08-13 0:56 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 1418 bytes --]
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] 18+ messages in thread
* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
2020-08-13 0:56 ` kernel test robot
@ 2020-08-13 0:56 ` kernel test robot
-1 siblings, 0 replies; 18+ 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] 18+ messages in thread
* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
@ 2020-08-13 0:56 ` kernel test robot
0 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2020-08-13 0:56 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3598 bytes --]
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] 18+ messages in thread
* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
2020-08-13 0:56 ` kernel test robot
@ 2020-08-13 0:56 ` kernel test robot
-1 siblings, 0 replies; 18+ 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] 18+ messages in thread
* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
@ 2020-08-13 0:56 ` kernel test robot
0 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2020-08-13 0:56 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 1917 bytes --]
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] 18+ messages in thread
* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
2020-08-13 0:56 ` kernel test robot
@ 2020-08-13 0:56 ` kernel test robot
-1 siblings, 0 replies; 18+ 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] 18+ messages in thread
* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
@ 2020-08-13 0:56 ` kernel test robot
0 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2020-08-13 0:56 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3394 bytes --]
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] 18+ messages in thread
* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
2020-08-13 0:56 ` kernel test robot
@ 2020-08-13 0:56 ` kernel test robot
-1 siblings, 0 replies; 18+ 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] 18+ messages in thread
* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
@ 2020-08-13 0:56 ` kernel test robot
0 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2020-08-13 0:56 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2384 bytes --]
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] 18+ messages in thread
* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
2020-08-13 0:56 ` kernel test robot
@ 2020-08-13 0:56 ` kernel test robot
-1 siblings, 0 replies; 18+ 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] 18+ messages in thread
* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
@ 2020-08-13 0:56 ` kernel test robot
0 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2020-08-13 0:56 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2296 bytes --]
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] 18+ messages in thread