提交 c51b1a16 编写于 作者: A Akinobu Mita 提交者: Linus Torvalds

xip: fix get_zeroed_page with __GFP_HIGHMEM

The use of get_zeroed_page() with __GFP_HIGHMEM is invalid.  Use
alloc_page() with __GFP_ZERO instead of invalid get_zeroed_page().

(This patch is only compile tested)

Cc: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
Acked-by: NHugh Dickins <hugh@veritas.com>
Acked-by: NCarsten Otte <cotte@de.ibm.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 0f94e87c
......@@ -25,14 +25,15 @@ static struct page *__xip_sparse_page;
static struct page *xip_sparse_page(void)
{
if (!__xip_sparse_page) {
unsigned long zeroes = get_zeroed_page(GFP_HIGHUSER);
if (zeroes) {
struct page *page = alloc_page(GFP_HIGHUSER | __GFP_ZERO);
if (page) {
static DEFINE_SPINLOCK(xip_alloc_lock);
spin_lock(&xip_alloc_lock);
if (!__xip_sparse_page)
__xip_sparse_page = virt_to_page(zeroes);
__xip_sparse_page = page;
else
free_page(zeroes);
__free_page(page);
spin_unlock(&xip_alloc_lock);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册