mirror of
https://github.com/torvalds/linux
synced 2024-09-06 09:51:23 +00:00
mm/mlock.c: change count_mm_mlocked_page_nr return type
On a 64-bit machine the value of "vma->vm_end - vma->vm_start" may be
negative when using 32 bit ints and the "count >> PAGE_SHIFT"'s result
will be wrong. So change the local variable and return value to
unsigned long to fix the problem.
Link: http://lkml.kernel.org/r/20190513023701.83056-1-swkhack@gmail.com
Fixes: 0cf2f6f6dc
("mm: mlock: check against vma for actual mlock() size")
Signed-off-by: swkhack <swkhack@gmail.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
7a30df49f6
commit
0874bb49bb
|
@ -636,11 +636,11 @@ static int apply_vma_lock_flags(unsigned long start, size_t len,
|
||||||
* is also counted.
|
* is also counted.
|
||||||
* Return value: previously mlocked page counts
|
* Return value: previously mlocked page counts
|
||||||
*/
|
*/
|
||||||
static int count_mm_mlocked_page_nr(struct mm_struct *mm,
|
static unsigned long count_mm_mlocked_page_nr(struct mm_struct *mm,
|
||||||
unsigned long start, size_t len)
|
unsigned long start, size_t len)
|
||||||
{
|
{
|
||||||
struct vm_area_struct *vma;
|
struct vm_area_struct *vma;
|
||||||
int count = 0;
|
unsigned long count = 0;
|
||||||
|
|
||||||
if (mm == NULL)
|
if (mm == NULL)
|
||||||
mm = current->mm;
|
mm = current->mm;
|
||||||
|
|
Loading…
Reference in a new issue