[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1413915307-20536-1-git-send-email-sasha.levin@oracle.com>
Date: Tue, 21 Oct 2014 14:15:07 -0400
From: Sasha Levin <sasha.levin@...cle.com>
To: akpm@...ux-foundation.org
Cc: n-horiguchi@...jp.nec.com, aarcange@...hat.com, mgorman@...e.de,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
a.ryabinin@...sung.com, Sasha Levin <sasha.levin@...cle.com>
Subject: [PATCH] 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 <sasha.levin@...cle.com>
---
include/linux/hugetlb.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 65e12a2..57e0dfd 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -312,7 +312,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)
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists