* [PATCH] 2.2.18 ext2 large file bug?
@ 2000-12-13 8:14 Andreas Dilger
2000-12-13 8:42 ` Alexander Viro
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Andreas Dilger @ 2000-12-13 8:14 UTC (permalink / raw)
To: Ext2 development mailing list, Linux FS development list
Cc: Linux kernel development list
Hello,
while looking at the COMPAT flag patches I made, I noticed the following
in the ext2/ext3 code. I believe that this bug is fixed in 2.4, but it
also needs to be fixed in 2.2. Basically, we are checking for an ext2
large file, which would be a file > 2GB on systems that don't support
such. However, we are checking for a file > 8GB which is clearly wrong.
The ext3 version of the patch is also attached.
Cheers, Andreas
==========================================================================
--- linux-2.2.18pre27-TL/fs/ext2/file.c.orig Mon Dec 11 22:43:17 2000
+++ linux-2.2.18pre27-TL/fs/ext2/file.c Wed Dec 13 00:13:00 2000
@@ -208,7 +208,7 @@
if (!count)
return -EFBIG;
}
- if (((pos + count) >> 31) &&
+ if (((pos + count) >> 33) &&
!(sb->u.ext2_sb.s_es->s_feature_ro_compat &
cpu_to_le32(EXT2_FEATURE_RO_COMPAT_LARGE_FILE))) {
/* If this is the first large file created, add a flag
--- linux-2.2.18pre27-TL/fs/ext3/file.c.orig Mon Dec 11 22:43:17 2000
+++ linux-2.2.18pre27-TL/fs/ext3/file.c Wed Dec 13 00:13:00 2000
@@ -208,7 +208,7 @@
if (!count)
return -EFBIG;
}
- if (((pos + count) >> 31) &&
+ if (((pos + count) >> 33) &&
!EXT3_HAS_RO_COMPAT_FEATURE(sb,
EXT3_FEATURE_RO_COMPAT_LARGE_FILE)) {
/* If this is the first large file created, add a flag
--
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] 2.2.18 ext2 large file bug?
2000-12-13 8:14 [PATCH] 2.2.18 ext2 large file bug? Andreas Dilger
@ 2000-12-13 8:42 ` Alexander Viro
2000-12-13 8:53 ` Andreas Dilger
2000-12-13 14:46 ` Alan Cox
2000-12-13 14:46 ` Alan Cox
2 siblings, 1 reply; 5+ messages in thread
From: Alexander Viro @ 2000-12-13 8:42 UTC (permalink / raw)
To: Andreas Dilger
Cc: Ext2 development mailing list, Linux FS development list,
Linux kernel development list
On Wed, 13 Dec 2000, Andreas Dilger wrote:
> Hello,
> while looking at the COMPAT flag patches I made, I noticed the following
> in the ext2/ext3 code. I believe that this bug is fixed in 2.4, but it
> also needs to be fixed in 2.2. Basically, we are checking for an ext2
> large file, which would be a file > 2GB on systems that don't support
> such. However, we are checking for a file > 8GB which is clearly wrong.
> The ext3 version of the patch is also attached.
> Cheers, Andreas
> ==========================================================================
> --- linux-2.2.18pre27-TL/fs/ext2/file.c.orig Mon Dec 11 22:43:17 2000
> +++ linux-2.2.18pre27-TL/fs/ext2/file.c Wed Dec 13 00:13:00 2000
> @@ -208,7 +208,7 @@
> if (!count)
> return -EFBIG;
> }
> - if (((pos + count) >> 31) &&
> + if (((pos + count) >> 33) &&
(x>>33) is the same as (x / (1LL<<33)). I.e. _with_ your change it
becomes "file >= 8Gb", instead of the current (correct) "file >= 2Gb".
Cheers,
Al
PS: Guys, 'fess up, who had written the following line?
for (i = 0, ino = SYSV_ROOT_INO+1, block = sb->sv_firstinodezone, j = SYSV_ROOT_INO ; i < sb->sv_fic_size && block < sb->sv_firstdatazone ; block++, j = 0) {
And yes, that's one line. fs/sysv/ialloc.c...
--
Exercise 1-3. Read this code aloud:
? if ((falloc(SMRHSHSCRTCH, S_IFEXT|0644, MAXRODDHSH)) < 0)
? ...
K&P
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] 2.2.18 ext2 large file bug?
2000-12-13 8:42 ` Alexander Viro
@ 2000-12-13 8:53 ` Andreas Dilger
0 siblings, 0 replies; 5+ messages in thread
From: Andreas Dilger @ 2000-12-13 8:53 UTC (permalink / raw)
To: Alexander Viro
Cc: Andreas Dilger, Ext2 development mailing list,
Linux FS development list, Linux kernel development list
Al Viro writes:
> (x>>33) is the same as (x / (1LL<<33)). I.e. _with_ your change it
> becomes "file >= 8Gb", instead of the current (correct) "file >= 2Gb".
OOPS. My bad. You are right. Time to hide head in sand.
Cheers, Andreas
--
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] 2.2.18 ext2 large file bug?
2000-12-13 8:14 [PATCH] 2.2.18 ext2 large file bug? Andreas Dilger
2000-12-13 8:42 ` Alexander Viro
@ 2000-12-13 14:46 ` Alan Cox
2000-12-13 14:46 ` Alan Cox
2 siblings, 0 replies; 5+ messages in thread
From: Alan Cox @ 2000-12-13 14:46 UTC (permalink / raw)
To: Andreas Dilger
Cc: Ext2 development mailing list, Linux FS development list,
Linux kernel development list
> also needs to be fixed in 2.2. Basically, we are checking for an ext2
> large file, which would be a file > 2GB on systems that don't support
> such. However, we are checking for a file > 8GB which is clearly wrong.
> The ext3 version of the patch is also attached.
Umm..
x>>33
is checking 8Gig
x>>31
is checking 2Gig
So your patch seems backwards
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] 2.2.18 ext2 large file bug?
2000-12-13 8:14 [PATCH] 2.2.18 ext2 large file bug? Andreas Dilger
2000-12-13 8:42 ` Alexander Viro
2000-12-13 14:46 ` Alan Cox
@ 2000-12-13 14:46 ` Alan Cox
2 siblings, 0 replies; 5+ messages in thread
From: Alan Cox @ 2000-12-13 14:46 UTC (permalink / raw)
To: Andreas Dilger
Cc: Ext2 development mailing list, Linux FS development list,
Linux kernel development list
Umm ignore that my brain is backwards.
Alan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2000-12-13 15:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-13 8:14 [PATCH] 2.2.18 ext2 large file bug? Andreas Dilger
2000-12-13 8:42 ` Alexander Viro
2000-12-13 8:53 ` Andreas Dilger
2000-12-13 14:46 ` Alan Cox
2000-12-13 14:46 ` Alan Cox
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).