[PATCH] scsi: Convert snprintf to scnprintf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix the following coccicheck warnings:

./drivers/scsi/myrb.c:2143:8-16: WARNING: use scnprintf or sprintf
./drivers/scsi/myrb.c:2153:8-16: WARNING: use scnprintf or sprintf
./drivers/scsi/myrb.c:2163:8-16: WARNING: use scnprintf or sprintf
./drivers/scsi/myrb.c:1889:10-18: WARNING: use scnprintf or sprintf
./drivers/scsi/myrb.c:1770:9-17: WARNING: use scnprintf or sprintf
./drivers/scsi/myrb.c:1906:9-17: WARNING: use scnprintf or sprintf

Signed-off-by: ztt <1549089851@xxxxxx>
---
 drivers/scsi/myrb.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/myrb.c b/drivers/scsi/myrb.c
index ca2e932dd9b7..7e3712c6e08f 100644
--- a/drivers/scsi/myrb.c
+++ b/drivers/scsi/myrb.c
@@ -1767,7 +1767,7 @@ static ssize_t raid_state_show(struct device *dev,
     int ret;

     if (!sdev->hostdata)
-        return snprintf(buf, 16, "Unknown\n");
+        return scnprintf(buf, 16, "Unknown\n");

     if (sdev->channel == myrb_logical_channel(sdev->host)) {
         struct myrb_ldev_info *ldev_info = sdev->hostdata;
@@ -1886,7 +1886,7 @@ static ssize_t raid_level_show(struct device *dev,

         name = myrb_raidlevel_name(ldev_info->raid_level);
         if (!name)
-            return snprintf(buf, 32, "Invalid (%02X)\n",
+            return scnprintf(buf, 32, "Invalid (%02X)\n",
                     ldev_info->state);
         return snprintf(buf, 32, "%s\n", name);
     }
@@ -1903,7 +1903,7 @@ static ssize_t rebuild_show(struct device *dev,
     unsigned char status;

     if (sdev->channel < myrb_logical_channel(sdev->host))
-        return snprintf(buf, 32, "physical device - not rebuilding\n");
+ return scnprintf(buf, 32, "physical device - not rebuilding\n");

     status = myrb_get_rbld_progress(cb, &rbld_buf);

@@ -2140,7 +2140,7 @@ static ssize_t ctlr_num_show(struct device *dev,
     struct Scsi_Host *shost = class_to_shost(dev);
     struct myrb_hba *cb = shost_priv(shost);

-    return snprintf(buf, 20, "%u\n", cb->ctlr_num);
+    return scnprintf(buf, 20, "%u\n", cb->ctlr_num);
 }
 static DEVICE_ATTR_RO(ctlr_num);

@@ -2150,7 +2150,7 @@ static ssize_t firmware_show(struct device *dev,
     struct Scsi_Host *shost = class_to_shost(dev);
     struct myrb_hba *cb = shost_priv(shost);

-    return snprintf(buf, 16, "%s\n", cb->fw_version);
+    return scnprintf(buf, 16, "%s\n", cb->fw_version);
 }
 static DEVICE_ATTR_RO(firmware);

@@ -2160,7 +2160,7 @@ static ssize_t model_show(struct device *dev,
     struct Scsi_Host *shost = class_to_shost(dev);
     struct myrb_hba *cb = shost_priv(shost);

-    return snprintf(buf, 16, "%s\n", cb->model_name);
+    return scnprintf(buf, 16, "%s\n", cb->model_name);
 }
 static DEVICE_ATTR_RO(model);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux