* drivers/hwmon/pmbus/inspur-ipsps.c:94:8-16: WARNING: use scnprintf or sprintf
@ 2020-11-22 19:07 kernel test robot
2020-11-22 19:07 ` [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-22 19:07 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 1210 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: a349e4c659609fd20e4beea89e5c4a4038e33a95
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script
date: 4 months ago
:::::: branch date: 25 hours ago
:::::: commit date: 4 months ago
config: x86_64-randconfig-c002-20201122 (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/hwmon/pmbus/inspur-ipsps.c:94:8-16: WARNING: use scnprintf or sprintf
drivers/hwmon/pmbus/inspur-ipsps.c:114:9-17: WARNING: use scnprintf or sprintf
drivers/hwmon/pmbus/inspur-ipsps.c:73: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: 27454 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
2020-11-22 19:07 drivers/hwmon/pmbus/inspur-ipsps.c:94:8-16: WARNING: use scnprintf or sprintf kernel test robot
@ 2020-11-22 19:07 ` kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2020-11-22 19:07 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 3068 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: Guenter Roeck <linux@roeck-us.net>
CC: Jean Delvare <jdelvare@suse.com>
CC: linux-hwmon(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org
From: kernel test robot <lkp@intel.com>
drivers/hwmon/pmbus/inspur-ipsps.c:94:8-16: WARNING: use scnprintf or sprintf
drivers/hwmon/pmbus/inspur-ipsps.c:114:9-17: WARNING: use scnprintf or sprintf
drivers/hwmon/pmbus/inspur-ipsps.c:73: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: a349e4c659609fd20e4beea89e5c4a4038e33a95
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script
:::::: branch date: 25 hours ago
:::::: commit date: 4 months ago
Please take the patch only if it's a positive warning. Thanks!
inspur-ipsps.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- a/drivers/hwmon/pmbus/inspur-ipsps.c
+++ b/drivers/hwmon/pmbus/inspur-ipsps.c
@@ -70,7 +70,7 @@ static ssize_t ipsps_string_show(struct
p = memscan(data, '#', rc);
*p = '\0';
- return snprintf(buf, PAGE_SIZE, "%s\n", data);
+ return scnprintf(buf, PAGE_SIZE, "%s\n", data);
}
static ssize_t ipsps_fw_version_show(struct device *dev,
@@ -91,7 +91,7 @@ static ssize_t ipsps_fw_version_show(str
if (rc != 6)
return -EPROTO;
- return snprintf(buf, PAGE_SIZE, "%u.%02u%u-%u.%02u\n",
+ return scnprintf(buf, PAGE_SIZE, "%u.%02u%u-%u.%02u\n",
data[1], data[2]/* < 100 */, data[3]/*< 10*/,
data[4], data[5]/* < 100 */);
}
@@ -111,19 +111,19 @@ static ssize_t ipsps_mode_show(struct de
switch (rc) {
case MODE_ACTIVE:
- return snprintf(buf, PAGE_SIZE, "[%s] %s %s\n",
+ return scnprintf(buf, PAGE_SIZE, "[%s] %s %s\n",
MODE_ACTIVE_STRING,
MODE_STANDBY_STRING, MODE_REDUNDANCY_STRING);
case MODE_STANDBY:
- return snprintf(buf, PAGE_SIZE, "%s [%s] %s\n",
+ return scnprintf(buf, PAGE_SIZE, "%s [%s] %s\n",
MODE_ACTIVE_STRING,
MODE_STANDBY_STRING, MODE_REDUNDANCY_STRING);
case MODE_REDUNDANCY:
- return snprintf(buf, PAGE_SIZE, "%s %s [%s]\n",
+ return scnprintf(buf, PAGE_SIZE, "%s %s [%s]\n",
MODE_ACTIVE_STRING,
MODE_STANDBY_STRING, MODE_REDUNDANCY_STRING);
default:
- return snprintf(buf, PAGE_SIZE, "unspecified\n");
+ return scnprintf(buf, PAGE_SIZE, "unspecified\n");
}
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-22 19:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-22 19:07 drivers/hwmon/pmbus/inspur-ipsps.c:94:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-11-22 19:07 ` [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.