Skip to contentSkip to conversation

nvme-cli: fix connecting failure due to invalid uuid format of hostid

PATCH New Guan Junxiong 3 participants 3 messages Aug 3, 2017 – Aug 10, 2017 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme-cli: fix connecting failure due to invalid uuid format of hostid

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(-)
fabrics.c +1 -1
index da4e04e..9ed1127 100644
@@ -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");
Signature · 1 line
2.11.1
#1 lore raw

PATCH 1/1 nvme-cli: fix connecting failure due to invalid uuid format of hostid

Quoted 7 lines · Guan Junxiong

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>
#2 lore raw

PATCH 1/1 nvme-cli: fix connecting failure due to invalid uuid format of hostid

Quoted 7 lines · Christoph Hellwig
Quoted 6 lines · Guan Junxiong

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.

Quoted 5 lines
Quoted 1 line
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.