From: Chris Leech <cleech@redhat.com>
To: hanyu001@208suo.com
Cc: jejb@linux.ibm.com, martin.petersen@oracle.com,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Fwd: [PATCH] scsi: be2iscsi: wacom: convert sysfs sprintf/snprintf family to sysfs_emit
Date: Wed, 19 Jul 2023 11:08:11 -0700 [thread overview]
Message-ID: <ZLgmi1I8MVlZnfcm@rhel-developer-toolbox-latest> (raw)
In-Reply-To: <a70b030b0e0bdf224d35dec9aecc7371@208suo.com>
On Fri, Jul 14, 2023 at 04:10:43PM +0800, hanyu001@208suo.com wrote:
> Fix the following coccicheck warning:
>
> ./drivers/hid/wacom_sys.c:1828:8-16: WARNING: use scnprintf or sprintf.
>
> ./drivers/scsi/be2iscsi/be_mgmt.c:1251:9-17: WARNING: use scnprintf or
> sprintf
> ./drivers/scsi/be2iscsi/be_mgmt.c:1145:8-16: WARNING: use scnprintf or
> sprintf
> ./drivers/scsi/be2iscsi/be_mgmt.c:1164:8-16: WARNING: use scnprintf or
> sprintf
> ./drivers/scsi/be2iscsi/be_mgmt.c:1280:8-16: WARNING: use scnprintf or
> sprintf
>
> Signed-off-by: ztt <1549089851@qq.com>
These should all be converted to sysfs_emit instead of scnprintf.
Thanks,
- Chris Leech
> ---
> drivers/scsi/be2iscsi/be_mgmt.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/scsi/be2iscsi/be_mgmt.c
> b/drivers/scsi/be2iscsi/be_mgmt.c
> index 4e899ec1477d..4916ce9c36a6 100644
> --- a/drivers/scsi/be2iscsi/be_mgmt.c
> +++ b/drivers/scsi/be2iscsi/be_mgmt.c
> @@ -1142,7 +1142,7 @@ ssize_t
> beiscsi_drvr_ver_disp(struct device *dev, struct device_attribute *attr,
> char *buf)
> {
> - return snprintf(buf, PAGE_SIZE, BE_NAME "\n");
> + return scnprintf(buf, PAGE_SIZE, BE_NAME "\n");
> }
>
> /**
> @@ -1161,7 +1161,7 @@ beiscsi_fw_ver_disp(struct device *dev, struct
> device_attribute *attr,
> struct Scsi_Host *shost = class_to_shost(dev);
> struct beiscsi_hba *phba = iscsi_host_priv(shost);
>
> - return snprintf(buf, PAGE_SIZE, "%s\n", phba->fw_ver_str);
> + return scnprintf(buf, PAGE_SIZE, "%s\n", phba->fw_ver_str);
> }
>
> /**
> @@ -1248,7 +1248,7 @@ beiscsi_adap_family_disp(struct device *dev, struct
> device_attribute *attr,
> case BE_DEVICE_ID1:
> case OC_DEVICE_ID1:
> case OC_DEVICE_ID2:
> - return snprintf(buf, PAGE_SIZE,
> + return scnprintf(buf, PAGE_SIZE,
> "Obsolete/Unsupported BE2 Adapter Family\n");
> case BE_DEVICE_ID2:
> case OC_DEVICE_ID3:
> @@ -1277,7 +1277,7 @@ beiscsi_phys_port_disp(struct device *dev, struct
> device_attribute *attr,
> struct Scsi_Host *shost = class_to_shost(dev);
> struct beiscsi_hba *phba = iscsi_host_priv(shost);
>
> - return snprintf(buf, PAGE_SIZE, "Port Identifier : %u\n",
> + return scnprintf(buf, PAGE_SIZE, "Port Identifier : %u\n",
> phba->fw_config.phys_port);
> }
prev parent reply other threads:[~2023-07-19 18:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <tencent_A27502E2D5B495E4E319441AB4B3B5F7E708@qq.com>
2023-07-14 8:10 ` Fwd: [PATCH] scsi: be2iscsi: wacom: convert sysfs sprintf/snprintf family to sysfs_emit hanyu001
2023-07-19 18:05 ` Chris Leech
2023-07-19 18:08 ` Chris Leech [this message]
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=ZLgmi1I8MVlZnfcm@rhel-developer-toolbox-latest \
--to=cleech@redhat.com \
--cc=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