All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@dilger.ca>
To: Adam Borowski <kilobyte@angband.pl>
Cc: Theodore Ts'o <tytso@mit.edu>, linux-ext4 <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] ext4: drop an always true check
Date: Wed, 17 Nov 2021 13:26:13 -0700	[thread overview]
Message-ID: <4423B081-F635-45FB-BFE3-0A75D8F5B0E0@dilger.ca> (raw)
In-Reply-To: <20211115172020.57853-1-kilobyte@angband.pl>

[-- Attachment #1: Type: text/plain, Size: 1227 bytes --]

On Nov 15, 2021, at 10:20 AM, Adam Borowski <kilobyte@angband.pl> wrote:
> 
> EXT_FIRST_INDEX(ptr) is ptr+12, which can't possibly be null; gcc-12
> warns about this.
> 
> Signed-off-by: Adam Borowski <kilobyte@angband.pl>

I was wondering if this was intending to check if path[depth].p_hdr was NULL,
but it is clear from the rest of the code that this could not be true, since
it is already being accessed earlier in the code, so this looks fine.

Reviewed-by: Andreas Dilger <adilger@dilger.ca>

> ---
> fs/ext4/extents.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index 0ecf819bf189..5aa279742da9 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -1496,8 +1496,7 @@ static int ext4_ext_search_left(struct inode *inode,
> 				EXT4_ERROR_INODE(inode,
> 				  "ix (%d) != EXT_FIRST_INDEX (%d) (depth %d)!",
> 				  ix != NULL ? le32_to_cpu(ix->ei_block) : 0,
> -				  EXT_FIRST_INDEX(path[depth].p_hdr) != NULL ?
> -		le32_to_cpu(EXT_FIRST_INDEX(path[depth].p_hdr)->ei_block) : 0,
> +				  le32_to_cpu(EXT_FIRST_INDEX(path[depth].p_hdr)->ei_block),
> 				  depth);
> 				return -EFSCORRUPTED;
> 			}
> --
> 2.33.1
> 


Cheers, Andreas






[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]

  reply	other threads:[~2021-11-17 20:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15 17:20 [PATCH] ext4: drop an always true check Adam Borowski
2021-11-17 20:26 ` Andreas Dilger [this message]
2022-01-06  4:41 ` Theodore Ts'o

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=4423B081-F635-45FB-BFE3-0A75D8F5B0E0@dilger.ca \
    --to=adilger@dilger.ca \
    --cc=kilobyte@angband.pl \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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.