From: Richard Weinberger <richard@nod.at>
To: chengzhihao1 <chengzhihao1@huawei.com>
Cc: Colin Ian King <colin.king@canonical.com>,
Dan Carpenter <dan.carpenter@oracle.com>,
linux-mtd <linux-mtd@lists.infradead.org>,
kernel-janitors <kernel-janitors@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ubifs: Remove a redundant null check on pointer lp
Date: Tue, 22 Jun 2021 09:24:15 +0200 (CEST) [thread overview]
Message-ID: <1471996381.142265.1624346654994.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <f2ea606a-4a05-8d14-4380-d96ca0f981a1@huawei.com>
----- Ursprüngliche Mail -----
> I just found out about it today thanks to your patch. Commit
> c770cd5190ba ("ubifs: fix an IS_ERR() vs NULL check") did import a new
> problem that ubifs_gc_start_commit() may return -ENOMEM while syncing fs.
> I guess ubifs_fast_find_frdi_idx() return NULL pointer is the
> termination condition in while-loop, which means we cannot get a
> freeable index LEB in ubifs_gc_start_commit().
Good catch! :-)
>> - if (!lp)
>> - break;
>> idx_gc = kmalloc(sizeof(struct ubifs_gced_idx_leb), GFP_NOFS);
>> if (!idx_gc) {
>> err = -ENOMEM;
>>
> BTW, the following modifications may be what you want?
> diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c
> index 7cc22d7317ea..b1f276599b04 100644
> --- a/fs/ubifs/gc.c
> +++ b/fs/ubifs/gc.c
> @@ -895,10 +895,6 @@ int ubifs_gc_start_commit(struct ubifs_info *c)
> /* Record index freeable LEBs for unmapping after commit */
> while (1) {
> lp = ubifs_fast_find_frdi_idx(c);
> - if (!lp) {
> - err = -ENOMEM;
> - goto out;
> - }
> if (!lp)
> break;
> idx_gc = kmalloc(sizeof(struct ubifs_gced_idx_leb),
> GFP_NOFS);
I'll drop Dan's patch from -next. Do you want to send a followup patch which removes the
in vain check?
Thanks,
//richard
prev parent reply other threads:[~2021-06-22 7:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-21 15:22 [PATCH] ubifs: Remove a redundant null check on pointer lp Colin King
2021-06-22 2:38 ` Zhihao Cheng
2021-06-22 6:44 ` Dan Carpenter
2021-06-22 7:26 ` Richard Weinberger
2021-06-22 7:24 ` Richard Weinberger [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=1471996381.142265.1624346654994.JavaMail.zimbra@nod.at \
--to=richard@nod.at \
--cc=chengzhihao1@huawei.com \
--cc=colin.king@canonical.com \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.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 NNTP newsgroup(s).