Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp920390imj; Sat, 9 Feb 2019 10:48:56 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib1nm6yzRz/uGD/uUhTGNFsLB57WaePuPRvinx4D3yZSXnYJafenqtUYlkquVE19geHnFF5 X-Received: by 2002:a62:442:: with SMTP id 63mr28225739pfe.156.1549738136182; Sat, 09 Feb 2019 10:48:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549738136; cv=none; d=google.com; s=arc-20160816; b=aPc28QOqPuT0sVpiX7Ye0EKHm8QpW1bWAmhEDWgSShCCj+ztNH9z1iP90A+stCuSPy p+VQQj2c7eCHKqgd9ApnLX5UVU+W7RLPPITSlKBsatzT2pgfkIPF+cMFCmdoJ8J/hf/d wbso+IyEhOMYu8XuMT1QucNhYD3j0ZJ7sILbZbYIx9J6BueOOzNtHtLNxOoUFuM5MLbR yOQXTzzQwH5lfM3OAoSeJy6PaEbuOJZrq6Dxqj7Umli7jtDtX1RKthdzuL7K54OCsxEP m2z3yOoYn1wC5Pmv6Yv6chOGCBtoAxiENUsRoIg2nwIswmsLNcQTN9TbE2tFf2byOSMe NBJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=06VZ8aWcfOEjU6J4xrfO8C+KuETSm0SIMEhZ7DskVEY=; b=MJee7Mv+8atPMOUsNReKQ6eC38bsi4oDxToDcOgiCYmrt2SIv5toJWzgTkeXKaIzL/ E/ho9viVOwLNzblFQJu+yabt/gLdXTkVQ6rHL7W5aCVK5uYGMFTMOKFJDUV0dZX3ILGS sXB0s42zjoJ5KiX/6wl3QIba9dEw4fX6bSmWiHrfDZfljIh9U8LL6E5/6aWCXVvyvRME Z3W7mLwXdVEDCZ0LneNWfARw3CTVel+FEn3FQpj+gqaz0rTZIiMtyJhDenR3pOa1OYHV xACmk9dqNoHGkHloe7+9oyZNRUyOuT9gWLqDmnE9hwTMup8f4VGTDGH7GOSwQkaQKwDc HoOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DW1pvgF2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6si5801807plk.44.2019.02.09.10.48.40; Sat, 09 Feb 2019 10:48:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DW1pvgF2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727567AbfBISsL (ORCPT + 99 others); Sat, 9 Feb 2019 13:48:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:60914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727518AbfBISsC (ORCPT ); Sat, 9 Feb 2019 13:48:02 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CFF4320821; Sat, 9 Feb 2019 18:48:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549738081; bh=gdFFga7h/iqfP0WDSc2HBhpsTd+JS/x1oNY3LxbUDYc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DW1pvgF2NqeymIxxkldm1ae2gBHbP1G+/66EBEyj1C6V6+/UDv4PUDJ75ntid1I9f WOITORLcZfCz83UrWX++ByfTJY8d9lHD+ZsmAtM67p29BLAk82jTT80KTuXr59RD7X rTME7kLpn904q2oi08pwkm4HsZ/zikp08ikRMqQw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Keith Busch , Christoph Hellwig , Sasha Levin , linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 4.20 24/42] nvme: pad fake subsys NQN vid and ssvid with zeros Date: Sat, 9 Feb 2019 13:47:16 -0500 Message-Id: <20190209184734.125935-24-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190209184734.125935-1-sashal@kernel.org> References: <20190209184734.125935-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Keith Busch [ Upstream commit 3da584f57133e51aeb84aaefae5e3d69531a1e4f ] 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 Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 962012135b62..971ca6754959 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2095,7 +2095,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); -- 2.19.1