Skip to contentSkip to conversation

scsi: Convert snprintf to scnprintf

PATCH New [email protected] 1 participant 1 message Jul 17, 2023 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 scsi: Convert snprintf to scnprintf

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

---
 drivers/scsi/myrb.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/myrb.c +6 -6
index ca2e932dd9b7..7e3712c6e08f 100644
@@ -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);