All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
Date: Wed, 02 Sep 2020 20:37:25 +0800	[thread overview]
Message-ID: <20200902123725.GA83097@b6768a2e92b6> (raw)
In-Reply-To: <202009022030.kO26QkOc%lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 5034 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: Hans de Goede <hdegoede@redhat.com>
CC: Jean Delvare <jdelvare@suse.com>
CC: Guenter Roeck <linux@roeck-us.net>
CC: linux-hwmon(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org

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

drivers/hwmon/sch5627.c:275:8-16: WARNING: use scnprintf or sprintf
drivers/hwmon/sch5627.c:288:8-16: WARNING: use scnprintf or sprintf
drivers/hwmon/sch5627.c:263:8-16: WARNING: use scnprintf or sprintf
drivers/hwmon/sch5627.c:312:8-16: WARNING: use scnprintf or sprintf
drivers/hwmon/sch5627.c:304:8-16: WARNING: use scnprintf or sprintf
drivers/hwmon/sch5627.c:198:8-16: WARNING: use scnprintf or sprintf
drivers/hwmon/sch5627.c:246:8-16: WARNING: use scnprintf or sprintf
drivers/hwmon/sch5627.c:224:8-16: WARNING: use scnprintf or sprintf
drivers/hwmon/sch5627.c:235:8-16: WARNING: use scnprintf or sprintf
drivers/hwmon/sch5627.c:212: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:   9c7d619be5a002ea29c172df5e3c1227c22cbb41
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script
:::::: branch date: 10 hours ago
:::::: commit date: 4 weeks ago

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

 sch5627.c |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

--- a/drivers/hwmon/sch5627.c
+++ b/drivers/hwmon/sch5627.c
@@ -195,7 +195,7 @@ static int reg_to_rpm(u16 reg)
 static ssize_t name_show(struct device *dev, struct device_attribute *devattr,
 	char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%s\n", DEVNAME);
+	return scnprintf(buf, PAGE_SIZE, "%s\n", DEVNAME);
 }
 
 static ssize_t temp_show(struct device *dev, struct device_attribute *devattr,
@@ -209,7 +209,7 @@ static ssize_t temp_show(struct device *
 		return PTR_ERR(data);
 
 	val = reg_to_temp(data->temp[attr->index]);
-	return snprintf(buf, PAGE_SIZE, "%d\n", val);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", val);
 }
 
 static ssize_t temp_fault_show(struct device *dev,
@@ -221,7 +221,7 @@ static ssize_t temp_fault_show(struct de
 	if (IS_ERR(data))
 		return PTR_ERR(data);
 
-	return snprintf(buf, PAGE_SIZE, "%d\n", data->temp[attr->index] == 0);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", data->temp[attr->index] == 0);
 }
 
 static ssize_t temp_max_show(struct device *dev,
@@ -232,7 +232,7 @@ static ssize_t temp_max_show(struct devi
 	int val;
 
 	val = reg_to_temp_limit(data->temp_max[attr->index]);
-	return snprintf(buf, PAGE_SIZE, "%d\n", val);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", val);
 }
 
 static ssize_t temp_crit_show(struct device *dev,
@@ -243,7 +243,7 @@ static ssize_t temp_crit_show(struct dev
 	int val;
 
 	val = reg_to_temp_limit(data->temp_crit[attr->index]);
-	return snprintf(buf, PAGE_SIZE, "%d\n", val);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", val);
 }
 
 static ssize_t fan_show(struct device *dev, struct device_attribute *devattr,
@@ -260,7 +260,7 @@ static ssize_t fan_show(struct device *d
 	if (val < 0)
 		return val;
 
-	return snprintf(buf, PAGE_SIZE, "%d\n", val);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", val);
 }
 
 static ssize_t fan_fault_show(struct device *dev,
@@ -272,7 +272,7 @@ static ssize_t fan_fault_show(struct dev
 	if (IS_ERR(data))
 		return PTR_ERR(data);
 
-	return snprintf(buf, PAGE_SIZE, "%d\n",
+	return scnprintf(buf, PAGE_SIZE, "%d\n",
 			data->fan[attr->index] == 0xffff);
 }
 
@@ -285,7 +285,7 @@ static ssize_t fan_min_show(struct devic
 	if (val < 0)
 		return val;
 
-	return snprintf(buf, PAGE_SIZE, "%d\n", val);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", val);
 }
 
 static ssize_t in_show(struct device *dev, struct device_attribute *devattr,
@@ -301,7 +301,7 @@ static ssize_t in_show(struct device *de
 	val = DIV_ROUND_CLOSEST(
 		data->in[attr->index] * SCH5627_REG_IN_FACTOR[attr->index],
 		10000);
-	return snprintf(buf, PAGE_SIZE, "%d\n", val);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", val);
 }
 
 static ssize_t in_label_show(struct device *dev,
@@ -309,7 +309,7 @@ static ssize_t in_label_show(struct devi
 {
 	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
 
-	return snprintf(buf, PAGE_SIZE, "%s\n",
+	return scnprintf(buf, PAGE_SIZE, "%s\n",
 			SCH5627_IN_LABELS[attr->index]);
 }
 

  parent reply	other threads:[~2020-09-02 12:37 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-02 12:37 drivers/edac/edac_mc_sysfs.c:210:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-09-02 12:37 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-09-02 12:37 ` kernel test robot [this message]
2020-09-02 12:37 ` kernel test robot
     [not found] <86ae66c7-927b-d41b-f097-b46f28943f58@linux.com>
2020-12-30  1:19 ` Rong Chen
  -- strict thread matches above, loose matches on Subject: below --
2020-12-29  7:35 drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c:1950:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-12-29  7:35 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-12-29  4:59 drivers/acpi/bgrt.c:28:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-12-29  4:59 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-12-27 20:04 drivers/edac/edac_mc_sysfs.c:210:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-12-27 20:04 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-12-27 20:04 ` kernel test robot
2020-12-27 20:04 ` kernel test robot
2020-12-27 20:04 ` kernel test robot
2020-12-27 20:05 ` kernel test robot
2020-12-27 20:05 ` kernel test robot
2020-12-27 20:05 ` kernel test robot
2020-12-27 20:05 ` kernel test robot
2020-12-27 20:05 ` kernel test robot
2020-12-14 17:27 drivers/hid/hid-sensor-custom.c:371:10-18: WARNING: use scnprintf or sprintf kernel test robot
2020-12-14 17:27 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-12-14 15:10 mm/backing-dev.c:209:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-12-14 15:10 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-12-14 15:10 ` kernel test robot
2020-12-14 15:10 ` kernel test robot
2020-12-14 15:10 ` kernel test robot
2020-12-14 15:10 ` kernel test robot
2020-12-14 15:10 ` kernel test robot
2020-12-10 21:20 drivers/hid/wacom_sys.c:1796:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-12-10 21:20 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-12-07  6:03 drivers/net/can/janz-ican3.c:1834:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-12-07  6:03 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-12-02 13:02 drivers/iio/trigger/iio-trig-hrtimer.c:41:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-12-02 13:02 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-12-01  1:10 drivers/scsi/fcoe/fcoe_sysfs.c:376:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-12-01  1:10 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-11-30 21:50 drivers/perf/fsl_imx8_ddr_perf.c:119:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-11-30 21:50 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-11-24 20:47 drivers/iio/trigger/stm32-timer-trigger.c:299:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-11-24 20:47 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
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
2020-11-22 10:27 drivers/char/ipmi/ipmi_msghandler.c:2694:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-11-22 10:27 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-11-20 11:52 drivers/crypto/picoxcell_crypto.c:1200:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-11-20 11:52 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-11-19  7:24 drivers/hwmon/occ/common.c:554:9-17: WARNING: use scnprintf or sprintf kernel test robot
2020-11-19  7:24 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-11-17 17:21 drivers/net/can/at91_can.c:1185:9-17: WARNING: use scnprintf or sprintf kernel test robot
2020-11-17 17:21 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-11-13 17:02 drivers/platform/x86/panasonic-laptop.c:371:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-11-13 17:02 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-11-12  1:20 drivers/net/can/janz-ican3.c:1834:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-11-12  1:20 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-11-05  1:14 drivers/platform/x86/sony-laptop.c:2054:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-11-05  1:14 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
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
2020-10-01  4:11 drivers/block/aoe/aoeblk.c:102:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-10-01  4:11 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-09-29 20:34 drivers/usb/usbip/stub_dev.c:33:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-09-29 20:34 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-09-15  7:28 drivers/video/fbdev/sstfb.c:736:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-09-15  7:28 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-09-15  7:28 ` kernel test robot
2020-09-12 22:57 drivers/scsi/isci/init.c:140:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-09-12 22:57 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-09-12 10:01 drivers/scsi/csiostor/csio_scsi.c:1433:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-09-12 10:01 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-09-10  8:53 drivers/scsi/53c700.c:2063:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-09-10  8:53 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-09-10  8:53 ` kernel test robot
2020-09-10  8:53 ` kernel test robot
2020-09-10  8:53 ` kernel test robot
2020-09-10  8:53 ` kernel test robot
2020-09-10  8:53 ` kernel test robot
2020-09-10  8:53 ` kernel test robot
2020-09-09 15:04 arch/x86/events/intel/pt.c:95:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-09-09 15:04 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-09-01  8:46 drivers/scsi/pmcraid.c:4091:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-09-01  8:46 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-08-26 19:38 drivers/scsi/aacraid/linit.c:1355:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-08-26 19:38 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-08-18 22:52 drivers/video/fbdev/sstfb.c:736:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-08-18 22:52 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
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
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
2020-08-13  0:56   ` kernel test robot
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-08-10  9:21   ` kernel test robot
2020-08-10  9:21   ` kernel test robot
2020-09-08 11:37   ` Bartlomiej Zolnierkiewicz
2020-09-08 11:37     ` Bartlomiej Zolnierkiewicz
2020-09-08 11:37     ` Bartlomiej Zolnierkiewicz
2020-09-08 12:08     ` Julia Lawall
2020-07-27  3:35 [jlawall:for-5.9 1/7] drivers/most/core.c:254:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-07-27  3:35 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-07-26 23:39 [jlawall:for-5.9 1/7] drivers/scsi/ufs/ufshcd.c:1749:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-07-26 23:39 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-07-08  2:42 [jlawall:for-5.9 1/3] drivers/char/hw_random/core.c:399:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-07-08  2:42 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-07-08  2:42 ` kernel test robot
2020-07-08  2:42 ` kernel test robot
2020-07-07 17:07 [jlawall:for-5.9 1/3] drivers/scsi/pcmcia/sym53c500_cs.c:621:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-07-07 17:07 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-07-03 11:35 [jlawall:for-5.9 1/3] drivers/tty/serial/8250/8250_port.c:2989:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-07-03 11:35 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-07-03 11:35 ` kernel test robot
2020-07-03 11:35 ` kernel test robot
2020-07-03 11:35 ` kernel test robot
2020-07-03 11:35 ` kernel test robot
2020-07-03 11:35 ` kernel test robot
2020-07-03 11:35 ` kernel test robot
2020-07-03 11:35 ` kernel test robot
2020-07-03 11:36 ` kernel test robot
2020-07-03 11:36 ` kernel test robot
2020-07-03 11:36 ` kernel test robot
2020-07-03 11:36 ` kernel test robot
2020-06-25  4:50 [jlawall:for-5.9 1/3] drivers/base/core.c:1526:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-06-25  4:50 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot
2020-06-25  3:41 [jlawall:for-5.9 1/3] arch/x86/events/core.c:2219:8-16: WARNING: use scnprintf or sprintf kernel test robot
2020-06-25  3:41 ` [PATCH] coccinelle: api: fix device_attr_show.cocci warnings kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200902123725.GA83097@b6768a2e92b6 \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.