bdev/nvme: fix UUID generation
Fix an off-by-one bug on serial string length that causes this assert:
bdev_nvme.c:2956: nvme_generate_uuid: Assertion `strlen(sn) <= SPDK_NVME_CTRLR_SN_LEN' failed.
Fixes: b5bdbbb95
("bdev: enable bdevs based on physical device to generate UUID")
Change-Id: I65d55f555625d8277fd25196ba5d2c886384ae24
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15563
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This commit is contained in:
parent
90755749b9
commit
ec3ac8b823
@ -3096,7 +3096,7 @@ nvme_disk_create(struct spdk_bdev *disk, const char *base_name,
|
||||
if (uuid) {
|
||||
disk->uuid = *uuid;
|
||||
} else if (g_opts.generate_uuids) {
|
||||
spdk_strcpy_pad(sn_tmp, cdata->sn, SPDK_NVME_CTRLR_SN_LEN + 1, '\0');
|
||||
spdk_strcpy_pad(sn_tmp, cdata->sn, SPDK_NVME_CTRLR_SN_LEN, '\0');
|
||||
disk->uuid = nvme_generate_uuid(sn_tmp, spdk_nvme_ns_get_id(ns));
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user