mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: raoxu <raoxu@uniontech.com>
Cc: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org,
	linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org,
	sagi@grimberg.me
Subject: Re: [PATCH nvme-7.3 3/4] nvme-fabrics: add helpers for subsystem and host identity options
Date: Wed, 2 Sep 2026 12:44:56 +0200	[thread overview]
Message-ID: <20260902104456.GD8206@lst.de> (raw)
In-Reply-To: <450E21059686C852+20260821062529.1936914-1-raoxu@uniontech.com>

On Fri, Aug 21, 2026 at 02:25:28PM +0800, raoxu wrote:
> +static int nvmf_parse_subsysnqn(struct nvmf_ctrl_options *opts, substring_t *args)
> +{
> +	char *nqn;
> +
> +	nqn = match_strdup(args);
> +	if (!nqn)
> +		return -ENOMEM;
> +
> +	kfree(opts->subsysnqn);
> +	opts->subsysnqn = nqn;
> +	if (strlen(opts->subsysnqn) >= NVMF_NQN_SIZE) {
> +		pr_err("%s needs to be < %d bytes\n",
> +		       opts->subsysnqn, NVMF_NQN_SIZE);
> +		return -EINVAL;
> +	}

I think we should only update opts->subsysnqn after the sanity check. The
current code doesn't do that, but we should use the chance to fix that
up as well.

> +	nqn = match_strdup(args);
> +	if (!nqn)
> +		return -ENOMEM;
> +
> +	if (strlen(nqn) >= NVMF_NQN_SIZE) {
> +		pr_err("%s needs to be < %d bytes\n", nqn, NVMF_NQN_SIZE);
> +		kfree(nqn);
> +		return -EINVAL;
> +	}
> +
> +	strscpy(hostnqn, nqn, NVMF_NQN_SIZE);
> +	kfree(nqn);

This already gets is right.  Also does anyone rememeber why we handled
the host vs subsys NQN so differently?


  parent reply	other threads:[~2026-09-02 10:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21  6:21 [PATCH nvme-7.3 0/4] nvme-fabrics: localize string option parsing raoxu
2026-08-21  6:24 ` [PATCH nvme-7.3 1/4] nvme-fabrics: separate option tokenizer pointer raoxu
2026-09-02 10:35   ` Christoph Hellwig
2026-08-21  6:25 ` [PATCH nvme-7.3 2/4] nvme-fabrics: add helper for owned string options raoxu
2026-08-22 22:12   ` Sagi Grimberg
2026-09-02 10:40   ` Christoph Hellwig
2026-08-21  6:25 ` [PATCH nvme-7.3 3/4] nvme-fabrics: add helpers for subsystem and host identity options raoxu
2026-08-22 22:11   ` Sagi Grimberg
2026-09-02 10:42     ` Christoph Hellwig
2026-09-02 10:44   ` Christoph Hellwig [this message]
2026-08-21  6:25 ` [PATCH nvme-7.3 4/4] nvme-fabrics: add helper for DH-CHAP secret options raoxu
2026-08-22 22:12   ` Sagi Grimberg
2026-09-02 10:45   ` 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=20260902104456.GD8206@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=raoxu@uniontech.com \
    --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®