linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext3 : Remove redundant condition in ext3_free_blocks_sb()
@ 2008-05-31 18:56 Manish Katiyar
  2008-05-31 19:05 ` Al Viro
  0 siblings, 1 reply; 4+ messages in thread
From: Manish Katiyar @ 2008-05-31 18:56 UTC (permalink / raw)
  To: linux-ext4, linux-fsdevel, kernel-janitors

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

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

Signed-off-by: Manish Katiyar <mkatiyar@gmail.com>

--- a/fs/ext3/balloc.c  2008-05-11 23:54:40.000000000 +0530
+++ b/fs/ext3/balloc.c  2008-06-01 00:05:25.000000000 +0530
@@ -493,7 +493,6 @@
        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 - "

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

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

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

* Re: [PATCH] ext3 : Remove redundant condition in ext3_free_blocks_sb()
  2008-05-31 18:56 [PATCH] ext3 : Remove redundant condition in ext3_free_blocks_sb() Manish Katiyar
@ 2008-05-31 19:05 ` Al Viro
  2008-05-31 19:10   ` Manish Katiyar
  0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2008-05-31 19:05 UTC (permalink / raw)
  To: Manish Katiyar; +Cc: linux-ext4, linux-fsdevel, kernel-janitors

On Sun, Jun 01, 2008 at 12:26:41AM +0530, Manish Katiyar wrote:
> For two unsigned values the check "block+count < block"  is always
> false. Thus the below patch removes that condition.

Really?  Always?

	unsigned block = 1;
	unsigned count = ~0U;

What will be the value and type of block + count?  What will be the
value of block + count < block?

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

* Re: [PATCH] ext3 : Remove redundant condition in ext3_free_blocks_sb()
  2008-05-31 19:05 ` Al Viro
@ 2008-05-31 19:10   ` Manish Katiyar
  2008-06-03 13:20     ` Matthew Wilcox
  0 siblings, 1 reply; 4+ messages in thread
From: Manish Katiyar @ 2008-05-31 19:10 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-ext4, linux-fsdevel, kernel-janitors

On Sun, Jun 1, 2008 at 12:35 AM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> On Sun, Jun 01, 2008 at 12:26:41AM +0530, Manish Katiyar wrote:
>> For two unsigned values the check "block+count < block"  is always
>> false. Thus the below patch removes that condition.
>
> Really?  Always?
>
>        unsigned block = 1;
>        unsigned count = ~0U;
>
> What will be the value and type of block + count?  What will be the
> value of block + count < block?

Oooops....my bad, but I doubt if we pass such values in ext* code anywhere.

>



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

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

* Re: [PATCH] ext3 : Remove redundant condition in ext3_free_blocks_sb()
  2008-05-31 19:10   ` Manish Katiyar
@ 2008-06-03 13:20     ` Matthew Wilcox
  0 siblings, 0 replies; 4+ messages in thread
From: Matthew Wilcox @ 2008-06-03 13:20 UTC (permalink / raw)
  To: Manish Katiyar; +Cc: Al Viro, linux-ext4, linux-fsdevel, kernel-janitors

On Sun, Jun 01, 2008 at 12:40:32AM +0530, Manish Katiyar wrote:
> Oooops....my bad, but I doubt if we pass such values in ext* code anywhere.

If we have a corrupt filesystem, we can pass total garbage here.  This
check prevents that from corrupting the filesystem further.  Patch NAKed
with extreme prejudice.

-- 
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

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

end of thread, other threads:[~2008-06-03 13:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-31 18:56 [PATCH] ext3 : Remove redundant condition in ext3_free_blocks_sb() Manish Katiyar
2008-05-31 19:05 ` Al Viro
2008-05-31 19:10   ` Manish Katiyar
2008-06-03 13:20     ` Matthew Wilcox

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