2008-05-31 18:56:46

by Manish Katiyar

[permalink] [raw]
Subject: [PATCH] ext4 : Remove redundant condition in ext4_free_blocks_sb()

For two unsigned values the check "block+count < block" is always
false. Thus the below patch removes that condition.

=============================================================

Signed-off-by: Manish Katiyar <[email protected]>

--- a/fs/ext4/balloc.c 2008-05-18 18:07:45.000000000 +0530
+++ b/fs/ext4/balloc.c 2008-06-01 00:05:48.000000000 +0530
@@ -619,7 +619,6 @@
sbi = EXT4_SB(sb);
es = sbi->s_es;
if (block < le32_to_cpu(es->s_first_data_block) ||
- block + count < block ||
block + count > ext4_blocks_count(es)) {
ext4_error (sb, "ext4_free_blocks",
"Freeing blocks not in datazone - "


=============================================================

--
Thanks & Regards,
********************************************
Manish Katiyar ( http://mkatiyar.googlepages.com )
3rd Floor, Fair Winds Block
EGL Software Park
Off Intermediate Ring Road
Bangalore 560071, India
***********************************************


2008-06-01 06:25:19

by Kari Hurtta

[permalink] [raw]
Subject: Re: [PATCH] ext4 : Remove redundant condition in ext4_free_blocks_sb()

"Manish Katiyar" <[email protected]> writes in
gmane.linux.file-systems:

> For two unsigned values the check "block+count < block" is always
> false. Thus the below patch removes that condition.
>
> =============================================================
>
> Signed-off-by: Manish Katiyar <[email protected]>
>
> --- a/fs/ext4/balloc.c 2008-05-18 18:07:45.000000000 +0530
> +++ b/fs/ext4/balloc.c 2008-06-01 00:05:48.000000000 +0530
> @@ -619,7 +619,6 @@
> sbi = EXT4_SB(sb);
> es = sbi->s_es;
> if (block < le32_to_cpu(es->s_first_data_block) ||
> - block + count < block ||
> block + count > ext4_blocks_count(es)) {
> ext4_error (sb, "ext4_free_blocks",
> "Freeing blocks not in datazone - "
>
>
> =============================================================

Hmm. Consider situation where block + count > max unsigned value
mathematically

in that case
block + count < block
expression may be true


> --
> Thanks & Regards,
> ********************************************
> Manish Katiyar ( http://mkatiyar.googlepages.com )
> 3rd Floor, Fair Winds Block
> EGL Software Park
> Off Intermediate Ring Road
> Bangalore 560071, India
> ***********************************************
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

/ Kari Hurtta


2008-06-01 06:30:04

by Manish Katiyar

[permalink] [raw]
Subject: Re: [PATCH] ext4 : Remove redundant condition in ext4_free_blocks_sb()

On Sun, Jun 1, 2008 at 11:55 AM, Kari Hurtta <[email protected]> wrote:
> "Manish Katiyar" <[email protected]> writes in
> gmane.linux.file-systems:
>
>> For two unsigned values the check "block+count < block" is always
>> false. Thus the below patch removes that condition.
>>
>> =============================================================
>>
>> Signed-off-by: Manish Katiyar <[email protected]>
>>
>> --- a/fs/ext4/balloc.c 2008-05-18 18:07:45.000000000 +0530
>> +++ b/fs/ext4/balloc.c 2008-06-01 00:05:48.000000000 +0530
>> @@ -619,7 +619,6 @@
>> sbi = EXT4_SB(sb);
>> es = sbi->s_es;
>> if (block < le32_to_cpu(es->s_first_data_block) ||
>> - block + count < block ||
>> block + count > ext4_blocks_count(es)) {
>> ext4_error (sb, "ext4_free_blocks",
>> "Freeing blocks not in datazone - "
>>
>>
>> =============================================================
>
> Hmm. Consider situation where block + count > max unsigned value
> mathematically
>
> in that case
> block + count < block
> expression may be true

Yeah.... my bad..... Al Viro pointed it out. Sorry for that


>
>
>> --
>> Thanks & Regards,
>> ********************************************
>> Manish Katiyar ( http://mkatiyar.googlepages.com )
>> 3rd Floor, Fair Winds Block
>> EGL Software Park
>> Off Intermediate Ring Road
>> Bangalore 560071, India
>> ***********************************************
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
>> the body of a message to [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> / Kari Hurtta
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>



--
Thanks & Regards,
********************************************
Manish Katiyar ( http://mkatiyar.googlepages.com )
3rd Floor, Fair Winds Block
EGL Software Park
Off Intermediate Ring Road
Bangalore 560071, India
***********************************************