From: Sasha Levin Date: Wed, 10 Dec 2014 23:44:13 +0000 (-0800) Subject: mm, hugetlb: correct bit shift in hstate_sizelog() X-Git-Tag: firefly_0821_release~176^2~2734^2~125 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=97ad2be1daf8e6f2d297aa349101b340e1327917;p=firefly-linux-kernel-4.4.55.git mm, hugetlb: correct bit shift in hstate_sizelog() hstate_sizelog() would shift left an int rather than long, triggering undefined behaviour and passing an incorrect value when the requested page size was more than 4GB, thus breaking >4GB pages. Signed-off-by: Sasha Levin Cc: Andrea Arcangeli Cc: Mel Gorman Cc: Andrey Ryabinin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 6e6d338641fe..cdd149ca5cc0 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -311,7 +311,8 @@ static inline struct hstate *hstate_sizelog(int page_size_log) { if (!page_size_log) return &default_hstate; - return size_to_hstate(1 << page_size_log); + + return size_to_hstate(1UL << page_size_log); } static inline struct hstate *hstate_vma(struct vm_area_struct *vma)