public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: hanyu001@208suo.com
To: jejb@linux.ibm.com, martin.petersen@oracle.com
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Fwd: [PATCH] scsi: snic: Convert snprintf to scnprintf
Date: Wed, 12 Jul 2023 18:16:28 +0800	[thread overview]
Message-ID: <fe09ebd8774d05dc4038e640d7ddb2e4@208suo.com> (raw)
In-Reply-To: <tencent_D20A645667548A8D5B1261D32ED4369FD70A@qq.com>

Coccinelle reports a warning:

drivers/scsi/snic/snic_attrs.c:35: WARNING: use scnprintf or sprintf
drivers/scsi/snic/snic_attrs.c:48: WARNING: use scnprintf or sprintf
drivers/scsi/snic/snic_attrs.c:26: WARNING: use scnprintf or sprintf:

Signed-off-by: ztt <1549089851@qq.com>
---
  drivers/scsi/snic/snic_attrs.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/snic/snic_attrs.c 
b/drivers/scsi/snic/snic_attrs.c
index 3ddbdbc3ded1..255cff16c2bd 100644
--- a/drivers/scsi/snic/snic_attrs.c
+++ b/drivers/scsi/snic/snic_attrs.c
@@ -13,7 +13,7 @@ snic_show_sym_name(struct device *dev,
  {
      struct snic *snic = shost_priv(class_to_shost(dev));

-    return snprintf(buf, PAGE_SIZE, "%s\n", snic->name);
+    return scnprintf(buf, PAGE_SIZE, "%s\n", snic->name);
  }

  static ssize_t
@@ -23,7 +23,7 @@ snic_show_state(struct device *dev,
  {
      struct snic *snic = shost_priv(class_to_shost(dev));

-    return snprintf(buf, PAGE_SIZE, "%s\n",
+    return scnprintf(buf, PAGE_SIZE, "%s\n",
              snic_state_str[snic_get_state(snic)]);
  }

@@ -32,7 +32,7 @@ snic_show_drv_version(struct device *dev,
                struct device_attribute *attr,
                char *buf)
  {
-    return snprintf(buf, PAGE_SIZE, "%s\n", SNIC_DRV_VERSION);
+    return scnprintf(buf, PAGE_SIZE, "%s\n", SNIC_DRV_VERSION);
  }

  static ssize_t
@@ -45,7 +45,7 @@ snic_show_link_state(struct device *dev,
      if (snic->config.xpt_type == SNIC_DAS)
          snic->link_status = svnic_dev_link_status(snic->vdev);

-    return snprintf(buf, PAGE_SIZE, "%s\n",
+    return scnprintf(buf, PAGE_SIZE, "%s\n",
              (snic->link_status) ? "Link Up" : "Link Down");
  }

       reply	other threads:[~2023-07-12 10:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <tencent_D20A645667548A8D5B1261D32ED4369FD70A@qq.com>
2023-07-12 10:16 ` hanyu001 [this message]
2023-07-14 14:56   ` [PATCH] scsi: snic: Convert snprintf to scnprintf David Laight
2023-07-12 10:27 ` Fwd: " 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=fe09ebd8774d05dc4038e640d7ddb2e4@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