linux/fs/f2fs
Chao Yu 2e023174a8 f2fs: avoid data offset overflow when lseeking huge file
xfstest generic/285 complains our issue in lseeking huge file.

Here is the detail output of generic/285:
"./check -f2fs tests/generic/285
Ran: generic/285
Failures: generic/285
Failed 1 of 1 tests

10. Test a huge file for offset overflow
10.01 SEEK_HOLE expected 65536 or 8589934592, got 65536.          succ
10.02 SEEK_HOLE expected 65536 or 8589934592, got 65536.          succ
10.03 SEEK_DATA expected 0 or 0, got 0.                           succ
10.04 SEEK_DATA expected 1 or 1, got 1.                           succ
10.05 SEEK_HOLE expected 8589934592 or 8589934592, got 0.         FAIL
10.06 SEEK_DATA expected 8589869056 or 8589869056, got 8589869056. succ
10.07 SEEK_DATA expected 8589869057 or 8589869057, got 8589869057. succ
10.08 SEEK_DATA expected 8589869056 or 8589869056, got 4294901760. FAIL"

The reason of this issue is:
We will calculate current offset through left shifting page-offset with
PAGE_CACHE_SHIFT bits, but our page-offset is a type of unsigned long, its size
is 4 bytes in 32-bits machine.

So if our page-offset is bigger than (1 << 32 / pagesize - 1), result of left
shifting will overflow.

Let's fix this issue by casting type of page-offset to type of current offset:
loff_t.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-02-11 17:04:46 -08:00
..
acl.c f2fs: fix a bug of inheriting default ACL from parent 2015-02-11 17:04:36 -08:00
acl.h f2fs: avoid deadlock on init_inode_metadata 2014-11-03 16:07:33 -08:00
checkpoint.c f2fs: merge {invalidate,release}page for meta/node/data pages 2015-02-11 17:04:44 -08:00
data.c f2fs: merge {invalidate,release}page for meta/node/data pages 2015-02-11 17:04:44 -08:00
debug.c f2fs: show the number of writeback pages in stat 2015-02-11 17:04:43 -08:00
dir.c f2fs: use missing the use of f2fs_kunmap_page 2015-01-09 17:02:22 -08:00
f2fs.h f2fs: introduce a batched trim 2015-02-11 17:04:44 -08:00
file.c f2fs: avoid data offset overflow when lseeking huge file 2015-02-11 17:04:46 -08:00
gc.c f2fs: split UMOUNT and FASTBOOT flags 2015-02-11 17:04:41 -08:00
gc.h f2fs: clean up {in,de}create_sleep_time 2015-02-11 17:04:37 -08:00
hash.c f2fs: fix wrong casting for dentry name 2014-08-29 00:26:50 -07:00
inline.c f2fs: make truncate_inline_date static 2015-02-11 17:04:37 -08:00
inode.c f2fs: get rid of kzalloc in __recover_inline_status 2015-01-09 17:02:27 -08:00
Kconfig f2fs: add f2fs_io_tracer support 2015-01-09 17:02:24 -08:00
Makefile f2fs: add f2fs_io_tracer support 2015-01-09 17:02:24 -08:00
namei.c f2fs: fix to use highmem for pages of newly created directory 2015-02-11 17:04:45 -08:00
node.c f2fs: merge {invalidate,release}page for meta/node/data pages 2015-02-11 17:04:44 -08:00
node.h f2fs: free radix_tree_nodes used by nat_set entries 2015-01-09 17:02:28 -08:00
recovery.c f2fs: merge flags in struct f2fs_sb_info 2015-02-11 17:04:38 -08:00
segment.c f2fs: introduce a batched trim 2015-02-11 17:04:44 -08:00
segment.h f2fs: merge flags in struct f2fs_sb_info 2015-02-11 17:04:38 -08:00
super.c f2fs: introduce a batched trim 2015-02-11 17:04:44 -08:00
trace.c f2fs: pids_lock can be static 2015-01-09 17:02:29 -08:00
trace.h f2fs: add f2fs_destroy_trace_ios to free radix tree 2015-01-09 17:02:28 -08:00
xattr.c f2fs: avoid deadlock on init_inode_metadata 2014-11-03 16:07:33 -08:00
xattr.h f2fs: avoid deadlock on init_inode_metadata 2014-11-03 16:07:33 -08:00