Skip to contentSkip to conversation

nvme: Pad fake subsys NQN vid and ssvid with zeros

PATCH New Keith Busch 2 participants 2 messages Jan 8, 2019 – Jan 9, 2019 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: Pad fake subsys NQN vid and ssvid with zeros

We need to preserve the leading zeros in the vid and ssvid when generating a unique NQN. Truncating these may lead to naming collisions.

Signed-off-by Keith Busch <keith.busch at intel.com>
---
 drivers/nvme/host/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -1
index 8daa13dd5c63..d8a5a6b377fd 100644
@@ -2186,7 +2186,7 @@ static void nvme_init_subnqn(struct nvme_subsystem *subsys, struct nvme_ctrl *ct
 
 	/* Generate a "fake" NQN per Figure 254 in NVMe 1.3 + ECN 001 */
 	off = snprintf(subsys->subnqn, NVMF_NQN_SIZE,
-			"nqn.2014.08.org.nvmexpress:%4x%4x",
+			"nqn.2014.08.org.nvmexpress:%04x%04x",
 			le16_to_cpu(id->vid), le16_to_cpu(id->ssvid));
 	memcpy(subsys->subnqn + off, id->sn, sizeof(id->sn));
 	off += sizeof(id->sn);
Signature · 1 line
2.14.4
maintainer Applied
#1 lore raw

PATCH 1/1 nvme: Pad fake subsys NQN vid and ssvid with zeros

Thanks,

applied to nvme-4.21.