Mike Kravetz 5df63c2a14 hugetlbfs: fix bug in pgoff overflow checking
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).

Link: http://lkml.kernel.org/r/20180330145402.5053-1-mike.kravetz@oracle.com
Fixes: 63489f8e8211 ("hugetlbfs: check for pgoff value overflow")
Reported-by: Dan Rue <dan.rue@linaro.org>
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Tested-by: Anders Roxell <anders.roxell@linaro.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Yisheng Xie <xieyisheng1@huawei.com>
Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Nic Losby <blurbdust@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-04-05 21:36:21 -07:00
..
2018-04-04 13:03:38 -07:00
2018-03-14 13:31:23 +01:00
2018-02-07 14:25:22 -08:00
2018-03-27 13:18:09 -04:00
2018-03-27 13:18:09 -04:00
2018-02-06 18:32:45 -08:00
2018-03-07 11:47:15 +01:00
2018-03-27 13:18:09 -04:00
2018-02-07 14:25:22 -08:00
2018-02-06 18:32:45 -08:00
2018-03-29 15:08:21 -04:00
2018-02-06 10:41:33 -08:00
2018-02-08 15:18:32 -08:00
2018-02-15 15:34:42 -05:00
2018-04-04 12:44:02 -07:00