All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-cli: fix connecting failure due to invalid uuid format of hostid
@ 2017-08-03 13:38 Guan Junxiong
  2017-08-10  9:09 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Guan Junxiong @ 2017-08-03 13:38 UTC (permalink / raw)


When we connect or discover a target with --hostid option via the
/etc/nvme/hostid file, we fails this operation because the hostid
is only 35 not 36 bytes which doesn't pass the uuid checking in the
kernel.The last character is overridden with null bytes because fgets
reads at most one less than sizeof of buffer characters.

Signed-off-by: Guan Junxiong <guanjunxiong at huawei.com>
---
 fabrics.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fabrics.c b/fabrics.c
index da4e04e..9ed1127 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -463,7 +463,7 @@ out:
 static int nvmf_hostid_file(void)
 {
 	FILE *f;
-	char hostid[NVMF_HOSTID_SIZE];
+	char hostid[NVMF_HOSTID_SIZE + 1];
 	int ret = false;
 
 	f = fopen(PATH_NVMF_HOSTID, "r");
-- 
2.11.1

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

* [PATCH] nvme-cli: fix connecting failure due to invalid uuid format of hostid
  2017-08-03 13:38 [PATCH] nvme-cli: fix connecting failure due to invalid uuid format of hostid Guan Junxiong
@ 2017-08-10  9:09 ` Christoph Hellwig
  2017-08-10 17:11   ` Keith Busch
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2017-08-10  9:09 UTC (permalink / raw)


On Thu, Aug 03, 2017@09:38:16PM +0800, Guan Junxiong wrote:
> When we connect or discover a target with --hostid option via the
> /etc/nvme/hostid file, we fails this operation because the hostid
> is only 35 not 36 bytes which doesn't pass the uuid checking in the
> kernel.The last character is overridden with null bytes because fgets
> reads at most one less than sizeof of buffer characters.
> 
> Signed-off-by: Guan Junxiong <guanjunxiong at huawei.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch at lst.de>

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

* [PATCH] nvme-cli: fix connecting failure due to invalid uuid format of hostid
  2017-08-10  9:09 ` Christoph Hellwig
@ 2017-08-10 17:11   ` Keith Busch
  0 siblings, 0 replies; 3+ messages in thread
From: Keith Busch @ 2017-08-10 17:11 UTC (permalink / raw)


On Thu, Aug 10, 2017@02:09:58AM -0700, Christoph Hellwig wrote:
> On Thu, Aug 03, 2017@09:38:16PM +0800, Guan Junxiong wrote:
> > When we connect or discover a target with --hostid option via the
> > /etc/nvme/hostid file, we fails this operation because the hostid
> > is only 35 not 36 bytes which doesn't pass the uuid checking in the
> > kernel.The last character is overridden with null bytes because fgets
> > reads at most one less than sizeof of buffer characters.
> > 
> > Signed-off-by: Guan Junxiong <guanjunxiong at huawei.com>
> 
> Looks good,
> 
> Reviewed-by: Christoph Hellwig <hch at lst.de>

I meant to reply to this one instead of the nvme_fc patch. This one to
nvme-cli is applied.

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-03 13:38 [PATCH] nvme-cli: fix connecting failure due to invalid uuid format of hostid Guan Junxiong
2017-08-10  9:09 ` Christoph Hellwig
2017-08-10 17:11   ` Keith Busch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.