From: Damien Le Moal <dlemoal@kernel.org>
To: Ian Kent <raven@themaw.net>, Bill O'Donnell <bodonnel@redhat.com>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] zonefs: convert zonefs to use the new mount api
Date: Mon, 12 Feb 2024 10:13:02 +0900 [thread overview]
Message-ID: <7cf58fb0-b13c-473c-b31c-864f0cac3754@kernel.org> (raw)
In-Reply-To: <3252c311-8f8f-4e73-8e4a-92bc6daebc7b@themaw.net>
On 2/11/24 12:36, Ian Kent wrote:
>>> +static void zonefs_free_fc(struct fs_context *fc)
>>> +{
>>> + struct zonefs_context *ctx = fc->fs_private;
>> I do not think you need this variable.
>
> That's a fair comment but it says fs_private contains the fs context
>
> for the casual reader.
>
>>
>>> +
>>> + kfree(ctx);
>> Is it safe to not set fc->fs_private to NULL ?
>
> I think it's been safe to call kfree() with a NULL argument for ages.
That I know, which is why I asked if *not* setting fc->fs_private to NULL after
the kfree is safe. Because if another call to kfree for that pointer is done, we
will endup with a double free oops. But as long as the mount API guarantees that
it will not happen, then OK.
>
>
> This could be done but so far the convention with mount api code
>
> appears to have been to add the local variable which I thought was for
> descriptive purposes but it could just be the result of cut and pastes.
Keeping the variable is fine. After all, that is not the fast path :)
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2024-02-12 1:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-09 0:08 [PATCH] zonefs: convert zonefs to use the new mount api Bill O'Donnell
2024-02-09 2:10 ` Damien Le Moal
2024-02-09 16:55 ` Bill O'Donnell
2024-02-11 2:01 ` Ian Kent
2024-02-11 3:36 ` Ian Kent
2024-02-12 1:13 ` Damien Le Moal [this message]
2024-02-12 12:12 ` Ian Kent
2024-02-13 23:31 ` Ian Kent
2024-02-13 23:37 ` Bill O'Donnell
2024-02-14 0:16 ` Damien Le Moal
2024-02-14 11:15 ` Damien Le Moal
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=7cf58fb0-b13c-473c-b31c-864f0cac3754@kernel.org \
--to=dlemoal@kernel.org \
--cc=bodonnel@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=raven@themaw.net \
/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;
as well as URLs for NNTP newsgroup(s).