|
@@ -138,10 +138,14 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
|
|
|
|
|
|
/*
|
|
|
* page based offset in vm_pgoff could be sufficiently large to
|
|
|
- * overflow a (l)off_t when converted to byte offset.
|
|
|
+ * overflow a loff_t when converted to byte offset. This can
|
|
|
+ * only happen on architectures where sizeof(loff_t) ==
|
|
|
+ * sizeof(unsigned long). So, only check in those instances.
|
|
|
*/
|
|
|
- if (vma->vm_pgoff & PGOFF_LOFFT_MAX)
|
|
|
- return -EINVAL;
|
|
|
+ if (sizeof(unsigned long) == sizeof(loff_t)) {
|
|
|
+ if (vma->vm_pgoff & PGOFF_LOFFT_MAX)
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
|
|
|
/* must be huge page aligned */
|
|
|
if (vma->vm_pgoff & (~huge_page_mask(h) >> PAGE_SHIFT))
|