nvme-cli: fix connecting failure due to invalid uuid format of hostid
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.
--- fabrics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fabrics.c +1 -1
@@ -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
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/hostidfile, 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,
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/hostidfile, 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.