From: David Howells <dhowells@redhat.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: dhowells@redhat.com, v9fs@lists.linux.dev, ericvh@kernel.org,
lucho@ionkov.net, asmadeus@codewreck.org,
linux_oss@crudebyte.com
Subject: Re: [RFC PATCH 4/4] 9p: convert to the new mount API
Date: Sat, 26 Jul 2025 15:09:25 +0100 [thread overview]
Message-ID: <511061.1753538965@warthog.procyon.org.uk> (raw)
In-Reply-To: <20250724023325.16178-5-sandeen@redhat.com>
Eric Sandeen <sandeen@redhat.com> wrote:
> + case Opt_uname:
> + kfree(v9ses_opts->uname);
> + v9ses_opts->uname = param->string;
> + param->string = NULL;
I wonder if it's worth using swap() for that:
v9ses_opts->uname = swap(param->string, NULL);
> + if (strcmp(s, "user") == 0)
> + v9ses_opts->flags |= V9FS_ACCESS_USER;
> + else if (strcmp(s, "any") == 0)
> + v9ses_opts->flags |= V9FS_ACCESS_ANY;
> + else if (strcmp(s, "client") == 0) {
> + v9ses_opts->flags |= V9FS_ACCESS_CLIENT;
> + } else {
Maybe put braces on all the clauses in that?
> +static void v9fs_free_fc(struct fs_context *fc)
> +{
> + struct v9fs_context *ctx = fc->fs_private;
I would check that ctx isn't NULL.
> +static int v9fs_init_fs_context(struct fs_context *fc)
> +{
> + struct v9fs_context *ctx;
> +
> + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
> + if (!ctx)
> + return -ENOMEM;
> +
> + /* initialize core options */
> + ctx->v9ses.afid = ~0;
> + ctx->v9ses.debug = 0;
> + ctx->v9ses.cache = CACHE_NONE;
> +#ifdef CONFIG_9P_FSCACHE
> + ctx->v9ses.cachetag = NULL;
> +#endif
You used kzalloc... ;-).
> +err_names:
> + kfree(ctx->v9ses.uname);
> + kfree(ctx->v9ses.aname);
> + kfree(ctx);
> + return -ENOMEM;
> +}
Instead of doing the freeing, you could just set ->need_free and if
->init_fs_context() returns an error, the context will be put and that will
invoke ->free().
David
next prev parent reply other threads:[~2025-07-26 14:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-24 2:23 [RFC PATCH 0/4] 9p: convert to the new mount API Eric Sandeen
2025-07-24 2:23 ` [RFC PATCH 1/4] fs/fs_parse: add back fsparam_u32hex Eric Sandeen
2025-07-24 2:23 ` [RFC PATCH 2/4] net/9p: move structures and macros to header files Eric Sandeen
2025-07-24 2:23 ` [RFC PATCH 3/4] 9p: create a v9fs_context structure to hold parsed options Eric Sandeen
2025-07-26 17:17 ` Eric Sandeen
2025-07-26 18:32 ` Eric Sandeen
2025-07-24 2:23 ` [RFC PATCH 4/4] 9p: convert to the new mount API Eric Sandeen
2025-07-26 14:09 ` David Howells [this message]
2025-07-26 17:29 ` Eric Sandeen
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=511061.1753538965@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=asmadeus@codewreck.org \
--cc=ericvh@kernel.org \
--cc=linux_oss@crudebyte.com \
--cc=lucho@ionkov.net \
--cc=sandeen@redhat.com \
--cc=v9fs@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.