commit 5df63c2a upstream.
This is a fix for a regression in 32 bit kernels caused by an invalid
check for pgoff overflow in hugetlbfs mmap setup. The check incorrectly
specified that the size of a loff_t was the same as the size of a long.
The regression prevents mapping hugetlbfs files at offsets greater than
4GB on 32 bit kernels.
On 32 bit kernels conversion from a page based unsigned long can not
overflow a loff_t byte offset. Therefore, skip this check if
sizeof(unsigned long) != sizeof(loff_t).
Fixes: 63489f8e ("hugetlbfs: check for pgoff value overflow")
Reported-by: Dan Rue <firstname.lastname@example.org>
Signed-off-by: Mike Kravetz <email@example.com>
Tested-by: Anders Roxell <firstname.lastname@example.org>
Cc: Michal Hocko <email@example.com>
Cc: Yisheng Xie <firstname.lastname@example.org>
Cc: "Kirill A . Shutemov" <email@example.com>
Cc: Nic Losby <firstname.lastname@example.org>
Signed-off-by: Andrew Morton <email@example.com>
Signed-off-by: Linus Torvalds <firstname.lastname@example.org>
Signed-off-by: Greg Kroah-Hartman <email@example.com>