linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvme: convert sysfs sprintf/snprintf family to sysfs_emit
@ 2021-02-02  7:06 Jiapeng Chong
  2021-02-02  7:56 ` Chaitanya Kulkarni
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jiapeng Chong @ 2021-02-02  7:06 UTC (permalink / raw)
  To: kbusch; +Cc: axboe, hch, sagi, linux-nvme, linux-kernel, Jiapeng Chong

Fix the following coccicheck warning:

./drivers/nvme/host/core.c:3580:8-16: WARNING: use scnprintf or sprintf.
./drivers/nvme/host/core.c:3570:8-16: WARNING: use scnprintf or sprintf.
./drivers/nvme/host/core.c:3560:8-16: WARNING: use scnprintf or sprintf.
./drivers/nvme/host/core.c:3526:8-16: WARNING: use scnprintf or sprintf.
./drivers/nvme/host/core.c:2833:8-16: WARNING: use scnprintf or sprintf.

Reported-by: Abaci Robot<abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 drivers/nvme/host/core.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index f13eb4d..5abbab3 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2830,7 +2830,7 @@ static ssize_t nvme_subsys_show_nqn(struct device *dev,
 	struct nvme_subsystem *subsys =
 		container_of(dev, struct nvme_subsystem, dev);
 
-	return snprintf(buf, PAGE_SIZE, "%s\n", subsys->subnqn);
+	return sysfs_emit(buf, "%s\n", subsys->subnqn);
 }
 static SUBSYS_ATTR_RO(subsysnqn, S_IRUGO, nvme_subsys_show_nqn);
 
@@ -3523,7 +3523,7 @@ static ssize_t nvme_sysfs_show_transport(struct device *dev,
 {
 	struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
 
-	return snprintf(buf, PAGE_SIZE, "%s\n", ctrl->ops->name);
+	return sysfs_emit(buf, "%s\n", ctrl->ops->name);
 }
 static DEVICE_ATTR(transport, S_IRUGO, nvme_sysfs_show_transport, NULL);
 
@@ -3557,7 +3557,7 @@ static ssize_t nvme_sysfs_show_subsysnqn(struct device *dev,
 {
 	struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
 
-	return snprintf(buf, PAGE_SIZE, "%s\n", ctrl->subsys->subnqn);
+	return sysfs_emit(buf, "%s\n", ctrl->subsys->subnqn);
 }
 static DEVICE_ATTR(subsysnqn, S_IRUGO, nvme_sysfs_show_subsysnqn, NULL);
 
@@ -3567,7 +3567,7 @@ static ssize_t nvme_sysfs_show_hostnqn(struct device *dev,
 {
 	struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
 
-	return snprintf(buf, PAGE_SIZE, "%s\n", ctrl->opts->host->nqn);
+	return sysfs_emit(buf, "%s\n", ctrl->opts->host->nqn);
 }
 static DEVICE_ATTR(hostnqn, S_IRUGO, nvme_sysfs_show_hostnqn, NULL);
 
@@ -3577,7 +3577,7 @@ static ssize_t nvme_sysfs_show_hostid(struct device *dev,
 {
 	struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
 
-	return snprintf(buf, PAGE_SIZE, "%pU\n", &ctrl->opts->host->id);
+	return sysfs_emit(buf, "%pU\n", &ctrl->opts->host->id);
 }
 static DEVICE_ATTR(hostid, S_IRUGO, nvme_sysfs_show_hostid, NULL);
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvme: convert sysfs sprintf/snprintf family to sysfs_emit
  2021-02-02  7:06 [PATCH] nvme: convert sysfs sprintf/snprintf family to sysfs_emit Jiapeng Chong
@ 2021-02-02  7:56 ` Chaitanya Kulkarni
  2021-02-03 10:02 ` Sagi Grimberg
  2021-02-03 16:13 ` Christoph Hellwig
  2 siblings, 0 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-02  7:56 UTC (permalink / raw)
  To: Jiapeng Chong, kbusch; +Cc: sagi, linux-kernel, linux-nvme, axboe, hch

On 2/1/21 23:12, Jiapeng Chong wrote:
> Fix the following coccicheck warning:
>
> ./drivers/nvme/host/core.c:3580:8-16: WARNING: use scnprintf or sprintf.
> ./drivers/nvme/host/core.c:3570:8-16: WARNING: use scnprintf or sprintf.
> ./drivers/nvme/host/core.c:3560:8-16: WARNING: use scnprintf or sprintf.
> ./drivers/nvme/host/core.c:3526:8-16: WARNING: use scnprintf or sprintf.
> ./drivers/nvme/host/core.c:2833:8-16: WARNING: use scnprintf or sprintf.
>
> Reported-by: Abaci Robot<abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Looks good.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvme: convert sysfs sprintf/snprintf family to sysfs_emit
  2021-02-02  7:06 [PATCH] nvme: convert sysfs sprintf/snprintf family to sysfs_emit Jiapeng Chong
  2021-02-02  7:56 ` Chaitanya Kulkarni
@ 2021-02-03 10:02 ` Sagi Grimberg
  2021-02-03 16:13 ` Christoph Hellwig
  2 siblings, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2021-02-03 10:02 UTC (permalink / raw)
  To: Jiapeng Chong, kbusch; +Cc: linux-kernel, linux-nvme, axboe, hch

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvme: convert sysfs sprintf/snprintf family to sysfs_emit
  2021-02-02  7:06 [PATCH] nvme: convert sysfs sprintf/snprintf family to sysfs_emit Jiapeng Chong
  2021-02-02  7:56 ` Chaitanya Kulkarni
  2021-02-03 10:02 ` Sagi Grimberg
@ 2021-02-03 16:13 ` Christoph Hellwig
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2021-02-03 16:13 UTC (permalink / raw)
  To: Jiapeng Chong; +Cc: kbusch, axboe, hch, sagi, linux-nvme, linux-kernel

Thanks,

applied to nvme-5.12.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-03 16:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02  7:06 [PATCH] nvme: convert sysfs sprintf/snprintf family to sysfs_emit Jiapeng Chong
2021-02-02  7:56 ` Chaitanya Kulkarni
2021-02-03 10:02 ` Sagi Grimberg
2021-02-03 16:13 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).