From: Baokun Li <libaokun1@huawei.com>
To: "Luís Henriques" <lhenriques@suse.de>
Cc: Theodore Ts'o <tytso@mit.edu>,
Andreas Dilger <adilger.kernel@dilger.ca>,
<wenqingliu0120@gmail.com>, <linux-ext4@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
"zhangyi (F)" <yi.zhang@huawei.com>, <yebin10@huawei.com>,
"yukuai (C)" <yukuai3@huawei.com>,
Baokun Li <libaokun1@huawei.com>
Subject: Re: [PATCH v2] ext4: fix bug in extents parsing when eh_entries == 0 and eh_depth > 0
Date: Fri, 12 Aug 2022 21:34:51 +0800 [thread overview]
Message-ID: <515c1447-9ca2-844c-0a89-a698157d14f6@huawei.com> (raw)
In-Reply-To: <YvZTcxF2DdtVEybn@suse.de>
Hi Luís,
On 8/12/2022 9:19 PM, Luís Henriques wrote:
> Hi Baokun!
>
> On Fri, Aug 12, 2022 at 08:50:34PM +0800, Baokun Li wrote:
>> Hi Luís,
> ...
>>> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
>>> index 53cfe2c681c4..a5457ac1999c 100644
>>> --- a/fs/ext4/extents.c
>>> +++ b/fs/ext4/extents.c
>>> @@ -460,6 +460,11 @@ static int __ext4_ext_check(const char *function, unsigned int line,
>>> error_msg = "invalid eh_entries";
>>> goto corrupted;
>>> }
>>> + if (unlikely((le16_to_cpu(eh->eh_entries) == 0) &&
>>> + (le16_to_cpu(eh->eh_depth > 0)))) {
le16_to_cpu(eh->eh_depth > 0) It's the wrong position of the parentheses here.
>> The parentheses are misplaced,
> I'm not sure I understand what you mean. I want to have
>
> if (unlikely((CONDITION A) && (CONDITION B))) {
> /* ... */
> }
>
> so they look correct. Or is that a matter of style/alignment? (Which
> checkpatch.pl doesn't complains about, by the way.)
>
>> and le16_to_cpu is not needed here.
> OK, I guess that, since both conditions do a comparison against '0', the
> le16_to_cpu() can be dropped. And, if the parentheses problem you
> mentioned above is a style problem, dropping it will also solve it because
> that statement will become
>
> if (unlikely((eh->eh_entries == 0) && (eh->eh_depth > 0))) {
> /* ... */
> }
Yeah, but it could be more streamlined here.
The earlier judgment has guaranteed "depth == eh->eh_depth"
> And once again, thanks for your review!
>
> Cheers,
--
With Best Regards,
Baokun Li
prev parent reply other threads:[~2022-08-12 13:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-12 10:53 [PATCH v2] ext4: fix bug in extents parsing when eh_entries == 0 and eh_depth > 0 Luís Henriques
2022-08-12 12:50 ` Baokun Li
2022-08-12 13:19 ` Luís Henriques
2022-08-12 13:34 ` Baokun Li [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=515c1447-9ca2-844c-0a89-a698157d14f6@huawei.com \
--to=libaokun1@huawei.com \
--cc=adilger.kernel@dilger.ca \
--cc=lhenriques@suse.de \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=wenqingliu0120@gmail.com \
--cc=yebin10@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yukuai3@huawei.com \
/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