CC: [email protected]
CC: [email protected]
TO: Denis Efremov <[email protected]>
CC: Julia Lawall <[email protected]>
CC: Adaptec OEM Raid Solutions <[email protected]>
CC: "James E.J. Bottomley" <[email protected]>
CC: "Martin K. Petersen" <[email protected]>
CC: [email protected]
CC: [email protected]

From: kernel test robot <[email protected]>

drivers/scsi/aacraid/linit.c:1355:8-16: WARNING: use scnprintf or sprintf
drivers/scsi/aacraid/linit.c:1381:8-16: WARNING: use scnprintf or sprintf
drivers/scsi/aacraid/linit.c:1388:8-16: WARNING: use scnprintf or sprintf
drivers/scsi/aacraid/linit.c:563:9-17: WARNING: use scnprintf or sprintf
drivers/scsi/aacraid/linit.c:590: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 <[email protected]>
Signed-off-by: kernel test robot <[email protected]>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   2ac69819ba9e3d8d550bb5d2d2df74848e556812
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add 
device_attr_show script
:::::: branch date: 19 hours ago
:::::: commit date: 3 weeks ago

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

 linit.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -560,10 +560,10 @@ static ssize_t aac_show_raid_level(struc
        struct scsi_device *sdev = to_scsi_device(dev);
        struct aac_dev *aac = (struct aac_dev *)(sdev->host->hostdata);
        if (sdev_channel(sdev) != CONTAINER_CHANNEL)
-               return snprintf(buf, PAGE_SIZE, sdev->no_uld_attach
+               return scnprintf(buf, PAGE_SIZE, sdev->no_uld_attach
                  ? "Hidden\n" :
                  ((aac->jbod && (sdev->type == TYPE_DISK)) ? "JBOD\n" : ""));
-       return snprintf(buf, PAGE_SIZE, "%s\n",
+       return scnprintf(buf, PAGE_SIZE, "%s\n",
          get_container_type(aac->fsa_dev[sdev_id(sdev)].type));
 }
 
@@ -587,7 +587,7 @@ static ssize_t aac_show_unique_id(struct
        if (sdev_channel(sdev) == CONTAINER_CHANNEL)
                memcpy(sn, aac->fsa_dev[sdev_id(sdev)].identifier, sizeof(sn));
 
-       return snprintf(buf, 16 * 2 + 2,
+       return scnprintf(buf, 16 * 2 + 2,
                
"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X\n",
                sn[0], sn[1], sn[2], sn[3],
                sn[4], sn[5], sn[6], sn[7],
@@ -1352,7 +1352,7 @@ static ssize_t aac_show_driver_version(s
                                        struct device_attribute *attr,
                                        char *buf)
 {
-       return snprintf(buf, PAGE_SIZE, "%s\n", aac_driver_version);
+       return scnprintf(buf, PAGE_SIZE, "%s\n", aac_driver_version);
 }
 
 static ssize_t aac_show_serial_number(struct device *device,
@@ -1378,14 +1378,14 @@ static ssize_t aac_show_serial_number(st
 static ssize_t aac_show_max_channel(struct device *device,
                                    struct device_attribute *attr, char *buf)
 {
-       return snprintf(buf, PAGE_SIZE, "%d\n",
+       return scnprintf(buf, PAGE_SIZE, "%d\n",
          class_to_shost(device)->max_channel);
 }
 
 static ssize_t aac_show_max_id(struct device *device,
                               struct device_attribute *attr, char *buf)
 {
-       return snprintf(buf, PAGE_SIZE, "%d\n",
+       return scnprintf(buf, PAGE_SIZE, "%d\n",
          class_to_shost(device)->max_id);
 }
 
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to