mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
mm: replace get_user_pages_unlocked() write/force parameters with gup_flags
This removes the 'write' and 'force' use from get_user_pages_unlocked() and replaces them with 'gup_flags' 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]> 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
d4944b0ece
commit
c164154f66
14 changed files with 27 additions and 36 deletions
14
mm/gup.c
14
mm/gup.c
|
|
@ -907,17 +907,10 @@ EXPORT_SYMBOL(__get_user_pages_unlocked);
|
|||
* "force" parameter).
|
||||
*/
|
||||
long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages,
|
||||
int write, int force, struct page **pages)
|
||||
struct page **pages, unsigned int gup_flags)
|
||||
{
|
||||
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,
|
||||
pages, flags);
|
||||
pages, gup_flags | FOLL_TOUCH);
|
||||
}
|
||||
EXPORT_SYMBOL(get_user_pages_unlocked);
|
||||
|
||||
|
|
@ -1535,7 +1528,8 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
|
|||
start += nr << PAGE_SHIFT;
|
||||
pages += nr;
|
||||
|
||||
ret = get_user_pages_unlocked(start, nr_pages - nr, write, 0, pages);
|
||||
ret = get_user_pages_unlocked(start, nr_pages - nr, pages,
|
||||
write ? FOLL_WRITE : 0);
|
||||
|
||||
/* Have to be a bit careful with return values */
|
||||
if (nr > 0) {
|
||||
|
|
|
|||
11
mm/nommu.c
11
mm/nommu.c
|
|
@ -197,17 +197,10 @@ long __get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm,
|
|||
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)
|
||||
struct page **pages, unsigned int gup_flags)
|
||||
{
|
||||
unsigned int flags = 0;
|
||||
|
||||
if (write)
|
||||
flags |= FOLL_WRITE;
|
||||
if (force)
|
||||
flags |= FOLL_FORCE;
|
||||
|
||||
return __get_user_pages_unlocked(current, current->mm, start, nr_pages,
|
||||
pages, flags);
|
||||
pages, gup_flags);
|
||||
}
|
||||
EXPORT_SYMBOL(get_user_pages_unlocked);
|
||||
|
||||
|
|
|
|||
|
|
@ -283,7 +283,8 @@ EXPORT_SYMBOL_GPL(__get_user_pages_fast);
|
|||
int __weak get_user_pages_fast(unsigned long start,
|
||||
int nr_pages, int write, struct page **pages)
|
||||
{
|
||||
return get_user_pages_unlocked(start, nr_pages, write, 0, pages);
|
||||
return get_user_pages_unlocked(start, nr_pages, pages,
|
||||
write ? FOLL_WRITE : 0);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(get_user_pages_fast);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue