From: hanyu001@208suo.com
To: jejb@linux.ibm.com, martin.petersen@oracle.com
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] scsi: Convert snprintf to scnprintf
Date: Mon, 17 Jul 2023 11:19:41 +0800 [thread overview]
Message-ID: <f713637fea0c666f0940be6066cba2ea@208suo.com> (raw)
In-Reply-To: <tencent_BEB5DAE7D9027BD58E958AE34A443CB4CB08@qq.com>
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(-)
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);
next parent reply other threads:[~2023-07-17 3:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <tencent_BEB5DAE7D9027BD58E958AE34A443CB4CB08@qq.com>
2023-07-17 3:19 ` hanyu001 [this message]
[not found] <tencent_104520BE1ABA5274FC82089096A176EA5C05@qq.com>
2023-07-17 6:44 ` hanyu001
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=f713637fea0c666f0940be6066cba2ea@208suo.com \
--to=hanyu001@208suo.com \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome