diff options
author | Andrew Morton <akpm@osdl.org> | 2006-01-08 04:03:05 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-08 23:13:54 -0500 |
commit | 54b21a7992a31d30c9a91f7e0a00ffdb4bd0caee (patch) | |
tree | 33eca2bf3c1edfd3d76cc0f7c96a392239c6d2ec /fs/buffer.c | |
parent | 676121fcb66c861804e38d94214fd5670a1ef595 (diff) |
[PATCH] fix possible PAGE_CACHE_SHIFT overflows
We've had two instances recently of overflows when doing
64_bit_value = (32_bit_value << PAGE_CACHE_SHIFT)
I did a tree-wide grep of `<<.*PAGE_CACHE_SHIFT' and this is the result.
- afs_rxfs_fetch_descriptor.offset is of type off_t, which seems broken.
- jfs and jffs are limited to 4GB anyway.
- reiserfs map_block_for_writepage() takes an unsigned long for the block -
it should take sector_t. (It'll fail for huge filesystems with
blocksize<PAGE_CACHE_SIZE)
- cramfs_read() needs to use sector_t (I think cramsfs is busted on large
filesystems anyway)
- affs is limited in file size anyway.
- I generally didn't fix 32-bit overflows in directory operations.
- arm's __flush_dcache_page() is peculiar. What if the page lies beyond 4G?
- gss_wrap_req_priv() needs checking (snd_buf->page_base)
Cc: Oleg Drokin <green@linuxhacker.ru>
Cc: David Howells <dhowells@redhat.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: <reiserfs-dev@namesys.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Anton Altaparmakov <aia21@cantab.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: <linux-fsdevel@vger.kernel.org>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/buffer.c')
-rw-r--r-- | fs/buffer.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index 263df0f192aa..55f0975a9b15 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -1762,7 +1762,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page, | |||
1762 | * handle that here by just cleaning them. | 1762 | * handle that here by just cleaning them. |
1763 | */ | 1763 | */ |
1764 | 1764 | ||
1765 | block = page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits); | 1765 | block = (sector_t)page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits); |
1766 | head = page_buffers(page); | 1766 | head = page_buffers(page); |
1767 | bh = head; | 1767 | bh = head; |
1768 | 1768 | ||
@@ -2635,7 +2635,7 @@ int block_truncate_page(struct address_space *mapping, | |||
2635 | pgoff_t index = from >> PAGE_CACHE_SHIFT; | 2635 | pgoff_t index = from >> PAGE_CACHE_SHIFT; |
2636 | unsigned offset = from & (PAGE_CACHE_SIZE-1); | 2636 | unsigned offset = from & (PAGE_CACHE_SIZE-1); |
2637 | unsigned blocksize; | 2637 | unsigned blocksize; |
2638 | pgoff_t iblock; | 2638 | sector_t iblock; |
2639 | unsigned length, pos; | 2639 | unsigned length, pos; |
2640 | struct inode *inode = mapping->host; | 2640 | struct inode *inode = mapping->host; |
2641 | struct page *page; | 2641 | struct page *page; |
@@ -2651,7 +2651,7 @@ int block_truncate_page(struct address_space *mapping, | |||
2651 | return 0; | 2651 | return 0; |
2652 | 2652 | ||
2653 | length = blocksize - length; | 2653 | length = blocksize - length; |
2654 | iblock = index << (PAGE_CACHE_SHIFT - inode->i_blkbits); | 2654 | iblock = (sector_t)index << (PAGE_CACHE_SHIFT - inode->i_blkbits); |
2655 | 2655 | ||
2656 | page = grab_cache_page(mapping, index); | 2656 | page = grab_cache_page(mapping, index); |
2657 | err = -ENOMEM; | 2657 | err = -ENOMEM; |