mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
mm: remove write/force parameters from __get_user_pages_unlocked()
This removes the redundant 'write' and 'force' parameters from __get_user_pages_unlocked() to make the use of FOLL_FORCE explicit in callers as use of this flag can result in surprising behaviour (and hence bugs) within the mm subsystem. Signed-off-by: Lorenzo Stoakes <[email protected]> Acked-by: Paolo Bonzini <[email protected]> Reviewed-by: Jan Kara <[email protected]> Acked-by: Michal Hocko <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
859110d749
commit
d4944b0ece
6 changed files with 34 additions and 19 deletions
17
mm/gup.c
17
mm/gup.c
|
|
@ -875,17 +875,11 @@ EXPORT_SYMBOL(get_user_pages_locked);
|
|||
*/
|
||||
__always_inline long __get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm,
|
||||
unsigned long start, unsigned long nr_pages,
|
||||
int write, int force, struct page **pages,
|
||||
unsigned int gup_flags)
|
||||
struct page **pages, unsigned int gup_flags)
|
||||
{
|
||||
long ret;
|
||||
int locked = 1;
|
||||
|
||||
if (write)
|
||||
gup_flags |= FOLL_WRITE;
|
||||
if (force)
|
||||
gup_flags |= FOLL_FORCE;
|
||||
|
||||
down_read(&mm->mmap_sem);
|
||||
ret = __get_user_pages_locked(tsk, mm, start, nr_pages, pages, NULL,
|
||||
&locked, false, gup_flags);
|
||||
|
|
@ -915,8 +909,15 @@ EXPORT_SYMBOL(__get_user_pages_unlocked);
|
|||
long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages,
|
||||
int write, int force, struct page **pages)
|
||||
{
|
||||
unsigned int flags = FOLL_TOUCH;
|
||||
|
||||
if (write)
|
||||
flags |= FOLL_WRITE;
|
||||
if (force)
|
||||
flags |= FOLL_FORCE;
|
||||
|
||||
return __get_user_pages_unlocked(current, current->mm, start, nr_pages,
|
||||
write, force, pages, FOLL_TOUCH);
|
||||
pages, flags);
|
||||
}
|
||||
EXPORT_SYMBOL(get_user_pages_unlocked);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue