From: Chao Yu <chao@kernel.org>
To: Hongbo Li <lihongbo22@huawei.com>,
kent.overstreet@linux.dev, bfoster@redhat.com
Cc: linux-bcachefs@vger.kernel.org
Subject: Re: [PATCH] bcachefs: fix error path of __bch2_read_super()
Date: Fri, 12 Apr 2024 14:32:35 +0800 [thread overview]
Message-ID: <99e80830-0eaf-423d-9250-6a0230fdcdc7@kernel.org> (raw)
In-Reply-To: <a021f61e-dc98-4324-916c-c65c6d979cc0@huawei.com>
On 2024/4/11 19:29, Hongbo Li wrote:
>
>
> On 2024/4/11 18:08, Chao Yu wrote:
>> In __bch2_read_super(), if kstrdup() fails, it needs to release memory
>> in sb->holder, fix to call bch2_free_super() in the error path.
>>
>> Signed-off-by: Chao Yu <chao@kernel.org>
>> ---
>> fs/bcachefs/super-io.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c
>> index ad28e370b640..cec1470c2dd9 100644
>> --- a/fs/bcachefs/super-io.c
>> +++ b/fs/bcachefs/super-io.c
>> @@ -698,8 +698,10 @@ static int __bch2_read_super(const char *path, struct bch_opts *opts,
>> return -ENOMEM;
>> sb->sb_name = kstrdup(path, GFP_KERNEL);
>> - if (!sb->sb_name)
>> - return -ENOMEM;
>> + if (!sb->sb_name) {
>> + ret = -ENOMEM;
> maybe you should fill err with message info by prt_printf(xxx), because err with no message info when printed in bch2_print_opts.
Oh, yes, will revise in v2, thank you for the comments.
Thanks,
>> + goto err;
>> + }
>> #ifndef __KERNEL__
>> if (opt_get(*opts, direct_io) == false)
prev parent reply other threads:[~2024-04-12 6:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-11 10:08 [PATCH] bcachefs: fix error path of __bch2_read_super() Chao Yu
2024-04-11 11:29 ` Hongbo Li
2024-04-12 6:32 ` Chao Yu [this message]
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=99e80830-0eaf-423d-9250-6a0230fdcdc7@kernel.org \
--to=chao@kernel.org \
--cc=bfoster@redhat.com \
--cc=kent.overstreet@linux.dev \
--cc=lihongbo22@huawei.com \
--cc=linux-bcachefs@vger.kernel.org \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).