* [PATCH] ext4: Add missing cast in ext4_fallocate
@ 2011-07-25 7:33 Utako Kusaka
2011-07-28 2:12 ` Ted Ts'o
0 siblings, 1 reply; 2+ messages in thread
From: Utako Kusaka @ 2011-07-25 7:33 UTC (permalink / raw)
To: linux-ext4, tytso
Cast map.m_lblk to loff_t.
File size is corrupt when we get an ENOSPC.
Logical block number is __u32, so new_size will be set to overflowed value.
# df -T /mnt/mp1
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sda6 ext4 9843276 153056 9190200 2% /mnt/mp1
# fallocate -o 0 -l 2199023251456 /mnt/mp1/testfile
fallocate: /mnt/mp1/testfile: fallocate failed: No space left on device
# stat /mnt/mp1/testfile
File: `/mnt/mp1/testfile'
Size: 4293656576 Blocks: 19380440 IO Block: 4096 regular file
Device: 806h/2054d Inode: 12 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2011-07-25 13:01:31.414490496 +0900
Modify: 2011-07-25 13:01:31.414490496 +0900
Change: 2011-07-25 13:01:31.454490495 +0900
Signed-off-by: Utako Kusaka <u-kusaka@wm.jp.nec.com>
--
fs/ext4/extents.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index f815cc8..a082f43 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -3835,7 +3835,7 @@ retry:
blkbits) >> blkbits))
new_size = offset + len;
else
- new_size = (map.m_lblk + ret) << blkbits;
+ new_size = ((loff_t)map.m_lblk + ret) << blkbits;
ext4_falloc_update_inode(inode, mode, new_size,
(map.m_flags & EXT4_MAP_NEW));
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ext4: Add missing cast in ext4_fallocate
2011-07-25 7:33 [PATCH] ext4: Add missing cast in ext4_fallocate Utako Kusaka
@ 2011-07-28 2:12 ` Ted Ts'o
0 siblings, 0 replies; 2+ messages in thread
From: Ted Ts'o @ 2011-07-28 2:12 UTC (permalink / raw)
To: Utako Kusaka; +Cc: linux-ext4
On Mon, Jul 25, 2011 at 04:33:49PM +0900, Utako Kusaka wrote:
> Cast map.m_lblk to loff_t.
>
> File size is corrupt when we get an ENOSPC.
> Logical block number is __u32, so new_size will be set to overflowed value.
>
> # df -T /mnt/mp1
> Filesystem Type 1K-blocks Used Available Use% Mounted on
> /dev/sda6 ext4 9843276 153056 9190200 2% /mnt/mp1
> # fallocate -o 0 -l 2199023251456 /mnt/mp1/testfile
> fallocate: /mnt/mp1/testfile: fallocate failed: No space left on device
> # stat /mnt/mp1/testfile
> File: `/mnt/mp1/testfile'
> Size: 4293656576 Blocks: 19380440 IO Block: 4096 regular file
> Device: 806h/2054d Inode: 12 Links: 1
> Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
> Access: 2011-07-25 13:01:31.414490496 +0900
> Modify: 2011-07-25 13:01:31.414490496 +0900
> Change: 2011-07-25 13:01:31.454490495 +0900
>
> Signed-off-by: Utako Kusaka <u-kusaka@wm.jp.nec.com>
Thanks, added to the ext4 tree.
- Ted
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-28 2:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-25 7:33 [PATCH] ext4: Add missing cast in ext4_fallocate Utako Kusaka
2011-07-28 2:12 ` Ted 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).