diff options
author | Becky Bruce <beckyb@kernel.crashing.org> | 2011-07-25 20:11:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-25 23:57:07 -0400 |
commit | 2b37c35e6552b0d04d5db9728bc7af22d53f731a (patch) | |
tree | 5ccccfe90e6bfb472e6000fd4f55c9be66eb795c /fs/hugetlbfs | |
parent | d694ad62bf539dbb20a0899ac2a954555f9e4a83 (diff) |
fs/hugetlbfs/inode.c: fix pgoff alignment checking on 32-bit
This:
vma->vm_pgoff & ~(huge_page_mask(h) >> PAGE_SHIFT)
is incorrect on 32-bit. It causes us to & the pgoff with something that
looks like this (for a 4m hugepage): 0xfff003ff. The mask should be
flipped and *then* shifted, to give you 0x0000_03fff.
Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/hugetlbfs')
-rw-r--r-- | fs/hugetlbfs/inode.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 7aafeb8fa300..537a2093c0e1 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -94,7 +94,7 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) | |||
94 | vma->vm_flags |= VM_HUGETLB | VM_RESERVED; | 94 | vma->vm_flags |= VM_HUGETLB | VM_RESERVED; |
95 | vma->vm_ops = &hugetlb_vm_ops; | 95 | vma->vm_ops = &hugetlb_vm_ops; |
96 | 96 | ||
97 | if (vma->vm_pgoff & ~(huge_page_mask(h) >> PAGE_SHIFT)) | 97 | if (vma->vm_pgoff & (~huge_page_mask(h) >> PAGE_SHIFT)) |
98 | return -EINVAL; | 98 | return -EINVAL; |
99 | 99 | ||
100 | vma_len = (loff_t)(vma->vm_end - vma->vm_start); | 100 | vma_len = (loff_t)(vma->vm_end - vma->vm_start); |