mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Javier González" <jg@lightnvm.io>
To: hch@lst.de, sagi@grimberg.me, keith.busch@intel.com, joe@perches.com
Cc: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org, "Javier González" <jg@lightnvm.io>,
	"Javier González" <javier@cnexlabs.com>
Subject: [PATCH v2] nvme: compare NQN string with right size
Date: Wed,  8 Nov 2017 10:59:03 +0100	[thread overview]
Message-ID: <1510135144-1557-1-git-send-email-javier@cnexlabs.com> (raw)

From: Javier González <jg@lightnvm.io>

Copy subnqns using NVMF_NQN_SIZE as it is < 256

Changes since V1:
  - Fix commit message to indicate that it is a copy and not a comparison.

Signed-off-by: Javier González <javier@cnexlabs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 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 37f9039bb9ca..b3bc9fb39a6c 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1744,7 +1744,7 @@ static void nvme_init_subnqn(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
 
 	nqnlen = strnlen(id->subnqn, NVMF_NQN_SIZE);
 	if (nqnlen > 0 && nqnlen < NVMF_NQN_SIZE) {
-		strcpy(ctrl->subnqn, id->subnqn);
+		strncpy(ctrl->subnqn, id->subnqn, NVMF_NQN_SIZE);
 		return;
 	}
 
-- 
2.7.4

             reply	other threads:[~2017-11-08  9:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-08  9:59 Javier González [this message]
2017-11-08  9:59 ` [PATCH v2] nvme: fix eui_show() print format Javier González
2017-11-08 10:08   ` Sagi Grimberg
2017-11-08 10:08 ` [PATCH v2] nvme: compare NQN string with right size Sagi Grimberg
2017-11-08 18:20 ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1510135144-1557-1-git-send-email-javier@cnexlabs.com \
    --to=jg@lightnvm.io \
    --cc=hch@lst.de \
    --cc=javier@cnexlabs.com \
    --cc=joe@perches.com \
    --cc=keith.busch@intel.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®