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