Commit c51b1a160b63304720d49479986915e4c475a2cf
Committed by
Linus Torvalds
1 parent
0f94e87cde
Exists in
master
and in
4 other branches
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: Akinobu Mita <akinobu.mita@gmail.com> Acked-by: Hugh Dickins <hugh@veritas.com> Acked-by: Carsten Otte <cotte@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 5 additions and 4 deletions Side-by-side Diff
mm/filemap_xip.c
... | ... | @@ -25,14 +25,15 @@ |
25 | 25 | static struct page *xip_sparse_page(void) |
26 | 26 | { |
27 | 27 | if (!__xip_sparse_page) { |
28 | - unsigned long zeroes = get_zeroed_page(GFP_HIGHUSER); | |
29 | - if (zeroes) { | |
28 | + struct page *page = alloc_page(GFP_HIGHUSER | __GFP_ZERO); | |
29 | + | |
30 | + if (page) { | |
30 | 31 | static DEFINE_SPINLOCK(xip_alloc_lock); |
31 | 32 | spin_lock(&xip_alloc_lock); |
32 | 33 | if (!__xip_sparse_page) |
33 | - __xip_sparse_page = virt_to_page(zeroes); | |
34 | + __xip_sparse_page = page; | |
34 | 35 | else |
35 | - free_page(zeroes); | |
36 | + __free_page(page); | |
36 | 37 | spin_unlock(&xip_alloc_lock); |
37 | 38 | } |
38 | 39 | } |