linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Ext4: remove a useless check for the function ext4_data_block_valid
@ 2011-01-26 22:45 Wang Shilong
  0 siblings, 0 replies; 6+ messages in thread
From: Wang Shilong @ 2011-01-26 22:45 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4

From: Wang Shilong <wangsl-fnst@cn.fujitsu.com>

Because it is no doubt 'start_blk + count < start_blk' always comes to
false. It is useless to have this check,remove it.

Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
---
 fs/ext4/block_validity.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
index 3f11656..5ffce82 100644
--- a/fs/ext4/block_validity.c
+++ b/fs/ext4/block_validity.c
@@ -226,7 +226,6 @@ int ext4_data_block_valid(struct ext4_sb_info *sbi, ext4_fsblk_t start_blk,
 	struct rb_node *n = sbi->system_blks.rb_node;
 
 	if ((start_blk <= le32_to_cpu(sbi->s_es->s_first_data_block)) ||
-	    (start_blk + count < start_blk) ||
 	    (start_blk + count > ext4_blocks_count(sbi->s_es))) {
 		sbi->s_es->s_last_error_block = cpu_to_le64(start_blk);
 		return 0;
-- 1.7.11.7


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

* [PATCH] Ext4: remove a useless check for the function ext4_data_block_valid
@ 2012-01-26 22:55 Wang Shilong
  0 siblings, 0 replies; 6+ messages in thread
From: Wang Shilong @ 2012-01-26 22:55 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4

From: Wang Shilong <wangsl-fnst@cn.fujitsu.com>

Because it is no doubt 'start_blk + count < start_blk' always comes to
false. It is useless to have this check,remove it.

Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
---
 fs/ext4/block_validity.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
index 3f11656..5ffce82 100644
--- a/fs/ext4/block_validity.c
+++ b/fs/ext4/block_validity.c
@@ -226,7 +226,6 @@ int ext4_data_block_valid(struct ext4_sb_info *sbi, ext4_fsblk_t start_blk,
 	struct rb_node *n = sbi->system_blks.rb_node;
 
 	if ((start_blk <= le32_to_cpu(sbi->s_es->s_first_data_block)) ||
-	    (start_blk + count < start_blk) ||
 	    (start_blk + count > ext4_blocks_count(sbi->s_es))) {
 		sbi->s_es->s_last_error_block = cpu_to_le64(start_blk);
 		return 0;
-- 1.7.11.7


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

* Re: [PATCH] Ext4: remove a useless check for the function ext4_data_block_valid
  2013-01-26 22:57 Wang Shilong
@ 2013-01-26 15:38 ` Theodore Ts'o
  2013-01-28  0:46   ` Wang Shilong
  0 siblings, 1 reply; 6+ messages in thread
From: Theodore Ts'o @ 2013-01-26 15:38 UTC (permalink / raw)
  To: Wang Shilong; +Cc: linux-ext4

On Sat, Jan 26, 2013 at 02:57:59PM -0800, Wang Shilong wrote:
> From: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
> 
> Because it is no doubt 'start_blk + count < start_blk' always comes to
> false. It is useless to have this check,remove it.

Actually, it can be true --- if start_blk + count (which are both
unsigned integers) overflows....

					- Ted

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

* [PATCH] Ext4: remove a useless check for the function ext4_data_block_valid
@ 2013-01-26 22:57 Wang Shilong
  2013-01-26 15:38 ` Theodore Ts'o
  0 siblings, 1 reply; 6+ messages in thread
From: Wang Shilong @ 2013-01-26 22:57 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4

From: Wang Shilong <wangsl-fnst@cn.fujitsu.com>

Because it is no doubt 'start_blk + count < start_blk' always comes to
false. It is useless to have this check,remove it.

Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
---
 fs/ext4/block_validity.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
index 3f11656..5ffce82 100644
--- a/fs/ext4/block_validity.c
+++ b/fs/ext4/block_validity.c
@@ -226,7 +226,6 @@ int ext4_data_block_valid(struct ext4_sb_info *sbi, ext4_fsblk_t start_blk,
 	struct rb_node *n = sbi->system_blks.rb_node;
 
 	if ((start_blk <= le32_to_cpu(sbi->s_es->s_first_data_block)) ||
-	    (start_blk + count < start_blk) ||
 	    (start_blk + count > ext4_blocks_count(sbi->s_es))) {
 		sbi->s_es->s_last_error_block = cpu_to_le64(start_blk);
 		return 0;
-- 1.7.11.7


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

* Re: [PATCH] Ext4: remove a useless check for the function ext4_data_block_valid
  2013-01-28  0:46   ` Wang Shilong
@ 2013-01-27 12:38     ` Theodore Ts'o
  0 siblings, 0 replies; 6+ messages in thread
From: Theodore Ts'o @ 2013-01-27 12:38 UTC (permalink / raw)
  To: Wang Shilong; +Cc: linux-ext4

On Sun, Jan 27, 2013 at 04:46:29PM -0800, Wang Shilong wrote:
> > Actually, it can be true --- if start_blk + count (which are both
> > unsigned integers) overflows....
>     Yeah,you are right....
>     I am sorry,I miss the overflow condition...

We added it because we saw a crash that was a caused by an overflow,
if memory serves correctly.  Or maybe it was a mysterious data or file
system corruption that was incredibly painful to find.

Fun trivia fact: the European Space Agency had the Ariane 5 rocket
explode on its maiden flight due to a integer overflow bug.

	       	      	     	      - Ted



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

* Re: [PATCH] Ext4: remove a useless check for the function ext4_data_block_valid
  2013-01-26 15:38 ` Theodore Ts'o
@ 2013-01-28  0:46   ` Wang Shilong
  2013-01-27 12:38     ` Theodore Ts'o
  0 siblings, 1 reply; 6+ messages in thread
From: Wang Shilong @ 2013-01-28  0:46 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-ext4

> On Sat, Jan 26, 2013 at 02:57:59PM -0800, Wang Shilong wrote:
>> From: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
>>
>> Because it is no doubt 'start_blk + count < start_blk' always comes to
>> false. It is useless to have this check,remove it.
> Actually, it can be true --- if start_blk + count (which are both
> unsigned integers) overflows....
    Yeah,you are right....
    I am sorry,I miss the overflow condition...
> 					- Ted
>


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

end of thread, other threads:[~2013-01-27 12:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-26 22:45 [PATCH] Ext4: remove a useless check for the function ext4_data_block_valid Wang Shilong
  -- strict thread matches above, loose matches on Subject: below --
2012-01-26 22:55 Wang Shilong
2013-01-26 22:57 Wang Shilong
2013-01-26 15:38 ` Theodore Ts'o
2013-01-28  0:46   ` Wang Shilong
2013-01-27 12:38     ` Theodore Ts'o

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