public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] nvme: compare NQN string with right size
@ 2017-11-08  9:59 Javier González
  2017-11-08  9:59 ` [PATCH v2] nvme: fix eui_show() print format Javier González
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Javier González @ 2017-11-08  9:59 UTC (permalink / raw)
  To: hch, sagi, keith.busch, joe
  Cc: linux-nvme, linux-block, linux-kernel, Javier González,
	Javier González

From: Javier González <jg@lightnvm.io>

Copy subnqns using NVMF_NQN_SIZE as it is < 256

Changes since V1:
  - Fix commit message to indicate that it is a copy and not a comparison.

Signed-off-by: Javier González <javier@cnexlabs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 37f9039bb9ca..b3bc9fb39a6c 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1744,7 +1744,7 @@ static void nvme_init_subnqn(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
 
 	nqnlen = strnlen(id->subnqn, NVMF_NQN_SIZE);
 	if (nqnlen > 0 && nqnlen < NVMF_NQN_SIZE) {
-		strcpy(ctrl->subnqn, id->subnqn);
+		strncpy(ctrl->subnqn, id->subnqn, NVMF_NQN_SIZE);
 		return;
 	}
 
-- 
2.7.4

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

* [PATCH v2] nvme: fix eui_show() print format
  2017-11-08  9:59 [PATCH v2] nvme: compare NQN string with right size Javier González
@ 2017-11-08  9:59 ` Javier González
  2017-11-08 10:08   ` Sagi Grimberg
  2017-11-08 10:08 ` [PATCH v2] nvme: compare NQN string with right size Sagi Grimberg
  2017-11-08 18:20 ` Christoph Hellwig
  2 siblings, 1 reply; 5+ messages in thread
From: Javier González @ 2017-11-08  9:59 UTC (permalink / raw)
  To: hch, sagi, keith.busch, joe
  Cc: linux-nvme, linux-block, linux-kernel, Javier González,
	Javier González

From: Javier González <jg@lightnvm.io>

Fix print formatting, but keep the original output to prevent user
breakage as suggested by Joe Perches.

Change since v1:
  - Maintain the original output format printing spaces instead of dashes

Signed-off-by: Javier González <javier@cnexlabs.com>
Reviewed-by: Keith Busch <keith.busch@intel.com>
---
 drivers/nvme/host/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index b3bc9fb39a6c..6c9d313c6f90 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2109,7 +2109,7 @@ static ssize_t eui_show(struct device *dev, struct device_attribute *attr,
 								char *buf)
 {
 	struct nvme_ns *ns = nvme_get_ns_from_dev(dev);
-	return sprintf(buf, "%8phd\n", ns->eui);
+	return sprintf(buf, "%8ph\n", ns->eui);
 }
 static DEVICE_ATTR(eui, S_IRUGO, eui_show, NULL);
 
-- 
2.7.4

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

* Re: [PATCH v2] nvme: compare NQN string with right size
  2017-11-08  9:59 [PATCH v2] nvme: compare NQN string with right size Javier González
  2017-11-08  9:59 ` [PATCH v2] nvme: fix eui_show() print format Javier González
@ 2017-11-08 10:08 ` Sagi Grimberg
  2017-11-08 18:20 ` Christoph Hellwig
  2 siblings, 0 replies; 5+ messages in thread
From: Sagi Grimberg @ 2017-11-08 10:08 UTC (permalink / raw)
  To: Javier González, hch, keith.busch, joe
  Cc: linux-nvme, linux-block, linux-kernel, Javier González

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

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

* Re: [PATCH v2] nvme: fix eui_show() print format
  2017-11-08  9:59 ` [PATCH v2] nvme: fix eui_show() print format Javier González
@ 2017-11-08 10:08   ` Sagi Grimberg
  0 siblings, 0 replies; 5+ messages in thread
From: Sagi Grimberg @ 2017-11-08 10:08 UTC (permalink / raw)
  To: Javier González, hch, keith.busch, joe
  Cc: linux-nvme, linux-block, linux-kernel, Javier González

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

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

* Re: [PATCH v2] nvme: compare NQN string with right size
  2017-11-08  9:59 [PATCH v2] nvme: compare NQN string with right size Javier González
  2017-11-08  9:59 ` [PATCH v2] nvme: fix eui_show() print format Javier González
  2017-11-08 10:08 ` [PATCH v2] nvme: compare NQN string with right size Sagi Grimberg
@ 2017-11-08 18:20 ` Christoph Hellwig
  2 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2017-11-08 18:20 UTC (permalink / raw)
  To: Javier González
  Cc: hch, sagi, keith.busch, joe, linux-nvme, linux-block,
	linux-kernel, Javier González

Thanks,

applied both patches to nvme-4.15.

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

end of thread, other threads:[~2017-11-08 18:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-08  9:59 [PATCH v2] nvme: compare NQN string with right size Javier González
2017-11-08  9:59 ` [PATCH v2] nvme: fix eui_show() print format Javier González
2017-11-08 10:08   ` Sagi Grimberg
2017-11-08 10:08 ` [PATCH v2] nvme: compare NQN string with right size Sagi Grimberg
2017-11-08 18:20 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox