All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: drop an always true check
@ 2021-11-15 17:20 Adam Borowski
  2021-11-17 20:26 ` Andreas Dilger
  2022-01-06  4:41 ` Theodore Ts'o
  0 siblings, 2 replies; 3+ messages in thread
From: Adam Borowski @ 2021-11-15 17:20 UTC (permalink / raw)
  To: Theodore Ts'o, Andreas Dilger, linux-ext4; +Cc: Adam Borowski

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>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: drop an always true check
  2021-11-15 17:20 [PATCH] ext4: drop an always true check Adam Borowski
@ 2021-11-17 20:26 ` Andreas Dilger
  2022-01-06  4:41 ` Theodore Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Dilger @ 2021-11-17 20:26 UTC (permalink / raw)
  To: Adam Borowski; +Cc: Theodore Ts'o, linux-ext4

[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: drop an always true check
  2021-11-15 17:20 [PATCH] ext4: drop an always true check Adam Borowski
  2021-11-17 20:26 ` Andreas Dilger
@ 2022-01-06  4:41 ` Theodore Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2022-01-06  4:41 UTC (permalink / raw)
  To: Adam Borowski, linux-ext4, Andreas Dilger; +Cc: Theodore Ts'o

On Mon, 15 Nov 2021 18:20:20 +0100, Adam Borowski wrote:
> EXT_FIRST_INDEX(ptr) is ptr+12, which can't possibly be null; gcc-12
> warns about this.
> 
> 

Applied, thanks!

[1/1] ext4: drop an always true check
      commit: a1f051415698049680c2bfb79d703e1ff7af36a3

Best regards,
-- 
Theodore Ts'o <tytso@mit.edu>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-06  4:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 17:20 [PATCH] ext4: drop an always true check Adam Borowski
2021-11-17 20:26 ` Andreas Dilger
2022-01-06  4:41 ` Theodore Ts'o

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.