mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
mm: mincore: replace __get_free_page() with kmalloc()
Remove ugly casts by using the more natural kmalloc/kfree allocation, also replace GFP_USER(pointless here) with GFP_KERNEL. Link: https://lore.kernel.org/20260717091347.1144789-4-wangkefeng.wang@huawei.com Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Reviewed-by: Pedro Falcato <pfalcato@suse.de> Acked-by: David Hildenbrand (Arm) <david@kernel.org> Cc: Jann Horn <jannh@google.com> Cc: Liam R. Howlett <liam@infradead.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Vlastimil Babka <vbabka@kernel.org> Cc: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
006943a9b4
commit
7625cb5673
|
|
@ -12,6 +12,7 @@
|
|||
#include <linux/gfp.h>
|
||||
#include <linux/pagewalk.h>
|
||||
#include <linux/mman.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/syscalls.h>
|
||||
#include <linux/swap.h>
|
||||
#include <linux/leafops.h>
|
||||
|
|
@ -328,7 +329,7 @@ SYSCALL_DEFINE3(mincore, unsigned long, start, size_t, len,
|
|||
if (!access_ok(vec, pages))
|
||||
return -EFAULT;
|
||||
|
||||
tmp = (void *) __get_free_page(GFP_USER);
|
||||
tmp = kmalloc(PAGE_SIZE, GFP_KERNEL);
|
||||
if (!tmp)
|
||||
return -EAGAIN;
|
||||
|
||||
|
|
@ -353,6 +354,6 @@ SYSCALL_DEFINE3(mincore, unsigned long, start, size_t, len,
|
|||
start += retval << PAGE_SHIFT;
|
||||
retval = 0;
|
||||
}
|
||||
free_page((unsigned long) tmp);
|
||||
kfree(tmp);
|
||||
return retval;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user