Unionfs: cast page->index loff_t before shifting
authorErez Zadok <ezk@cs.sunysb.edu>
Fri, 16 Nov 2007 18:46:16 +0000 (13:46 -0500)
committerRachita Kothiyal <rachita@dewey.fsl.cs.sunysb.edu>
Thu, 1 May 2008 23:03:08 +0000 (19:03 -0400)
Fixes bugs in number promotion/demotion computation, as per
<http://lkml.org/lkml/2007/9/20/17>

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/mmap.c

index 88ef6a6d47d3626c7e338e5e6206c17b0ed3f414..37af97927a79cdef36639eccb49cd93f145fccfb 100644 (file)
@@ -179,7 +179,8 @@ static int unionfs_do_readpage(struct file *file, struct page *page)
         * may be a little slower, but a lot safer, as the VFS does a lot of
         * the necessary magic for us.
         */
-       offset = lower_file->f_pos = (page->index << PAGE_CACHE_SHIFT);
+       offset = lower_file->f_pos =
+               ((loff_t) page->index << PAGE_CACHE_SHIFT);
        old_fs = get_fs();
        set_fs(KERNEL_DS);
        err = vfs_read(lower_file, page_data, PAGE_CACHE_SIZE,
@@ -289,7 +290,7 @@ static int unionfs_commit_write(struct file *file, struct page *page,
        BUG_ON(lower_file == NULL);
 
        page_data = (char *)kmap(page);
-       lower_file->f_pos = (page->index << PAGE_CACHE_SHIFT) + from;
+       lower_file->f_pos = ((loff_t) page->index << PAGE_CACHE_SHIFT) + from;
 
        /*
         * SP: I use vfs_write instead of copying page data and the