From: raoxu <raoxu@uniontech.com>
To: 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: [PATCH nvme-7.3 v3 1/4] nvme-fabrics: separate option tokenizer pointer
Date: Mon, 31 Aug 2026 15:10:50 +0800 [thread overview]
Message-ID: <67C2BD21B4A592D4+20260831071050.637726-1-raoxu@uniontech.com> (raw)
In-Reply-To: <B1A2864319EA3B6C+20260831070557.631487-1-raoxu@uniontech.com>
From: Xu Rao <raoxu@uniontech.com>
nvmf_parse_options() currently uses p both for the option returned by
strsep() and for strings allocated by match_strdup(). The former points
into the temporary options buffer while the latter owns a separate
allocation, so the same variable represents two different lifetimes.
Introduce option for the current string token passed to match_token().
Leave p for temporary strings returned by match_strdup(), giving option
tokenization and allocated string storage distinct variables without
changing the parsing logic.
The name option is intentional: options remains the backing buffer for the
full request, option is one comma/newline-delimited entry, and token names
the integer result returned by match_token().
This is a mechanical preparation with no functional change.
Suggested-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Xu Rao <raoxu@uniontech.com>
---
drivers/nvme/host/fabrics.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 59f823dfbbcc..1ec6da49167d 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -716,7 +716,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
const char *buf)
{
substring_t args[MAX_OPT_ARGS];
- char *options, *o, *p;
+ char *options, *o, *option, *p;
int token, ret = 0;
size_t nqnlen = 0;
int ctrl_loss_tmo = NVMF_DEF_CTRL_LOSS_TMO, key_id;
@@ -747,11 +747,11 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
uuid_copy(&hostid, &nvmf_default_host->id);
strscpy(hostnqn, nvmf_default_host->nqn, NVMF_NQN_SIZE);
- while ((p = strsep(&o, ",\n")) != NULL) {
- if (!*p)
+ while ((option = strsep(&o, ",\n")) != NULL) {
+ if (!*option)
continue;
- token = match_token(p, opt_tokens, args);
+ token = match_token(option, opt_tokens, args);
opts->mask |= token;
switch (token) {
case NVMF_OPT_TRANSPORT:
@@ -1068,7 +1068,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
break;
default:
pr_warn("unknown parameter or missing value '%s' in ctrl creation request\n",
- p);
+ option);
ret = -EINVAL;
goto out;
}
--
2.50.1
next prev parent reply other threads:[~2026-08-31 7:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 7:05 [PATCH nvme-7.3 v3 0/4] nvme-fabrics: localize string option parsing raoxu
2026-08-31 7:10 ` raoxu [this message]
2026-09-02 13:32 ` [PATCH nvme-7.3 v3 1/4] nvme-fabrics: separate option tokenizer pointer Christoph Hellwig
2026-08-31 7:11 ` [PATCH nvme-7.3 v3 2/4] nvme-fabrics: add helper for owned string options raoxu
2026-09-02 13:33 ` Christoph Hellwig
2026-08-31 7:11 ` [PATCH nvme-7.3 v3 3/4] nvme-fabrics: reuse string helper for subsystem NQN raoxu
2026-08-31 7:11 ` [PATCH nvme-7.3 v3 4/4] nvme-fabrics: add helper for DH-CHAP secret options raoxu
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=67C2BD21B4A592D4+20260831071050.637726-1-raoxu@uniontech.com \
--to=raoxu@uniontech.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=kbusch@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®