Patchwork [2/2] Ext3: remove a useless check for the function ext3_free_blocks_sb

login
register
mail settings
Submitter Wang shilong
Date Jan. 26, 2011, 10:48 p.m.
Message ID <4D40A4B7.6050501@gmail.com>
Download mbox | patch
Permalink /patch/215889/
State New
Headers show

Comments

Wang shilong - Jan. 26, 2011, 10:48 p.m.
From: Wang Shilong <wangsl-fnst@cn.fujitsu.com>

Because 'block + count < block' always comes to false, it is useless
to have this check, just remove it.

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

-- 1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andreas Dilger - Jan. 27, 2013, 7:40 a.m.
On 2011-01-26, at 15:48, Wang Shilong <wangshilong1991@gmail.com> wrote:

> From: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
> 
> Because 'block + count < block' always comes to false, it is useless
> to have this check, just remove it.

This check can be true if the sum overflows the 32-bit variable it is stored in, so it is not useless...

Cheers, Andreas

> Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
> ---
> fs/ext3/balloc.c | 1 -
> 1 file changed, 1 deletion(-)
> 
> diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c
> index 22548f5..c557f22 100644
> --- a/fs/ext3/balloc.c
> +++ b/fs/ext3/balloc.c
> @@ -507,7 +507,6 @@ void ext3_free_blocks_sb(handle_t *handle, struct super_block *sb,
>    sbi = EXT3_SB(sb);
>    es = sbi->s_es;
>    if (block < le32_to_cpu(es->s_first_data_block) ||
> -        block + count < block ||
>        block + count > le32_to_cpu(es->s_blocks_count)) {
>        ext3_error (sb, "ext3_free_blocks",
>                "Freeing blocks not in datazone - "
> -- 1.7.11.7
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c
index 22548f5..c557f22 100644
--- a/fs/ext3/balloc.c
+++ b/fs/ext3/balloc.c
@@ -507,7 +507,6 @@  void ext3_free_blocks_sb(handle_t *handle, struct super_block *sb,
 	sbi = EXT3_SB(sb);
 	es = sbi->s_es;
 	if (block < le32_to_cpu(es->s_first_data_block) ||
-	    block + count < block ||
 	    block + count > le32_to_cpu(es->s_blocks_count)) {
 		ext3_error (sb, "ext3_free_blocks",
 			    "Freeing blocks not in datazone - "