lkml.org 
[lkml]   [2017]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] mm/migrate: Fix early increment of migrate->npages
Date
The intention here is to set the same array element in src and dst.
Switch the order of these lines so that migrate->npages is only
incremented after we've used it.

Fixes: 8315ada7f095 ("mm/migrate: allow migrate_vma() to alloc new page on empty entry")
Cc: Jérôme Glisse <jglisse@redhat.com>
Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
---
mm/migrate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index dea0ceb..c4546cc 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -2146,8 +2146,8 @@ static int migrate_vma_collect_hole(unsigned long start,
unsigned long addr;

for (addr = start & PAGE_MASK; addr < end; addr += PAGE_SIZE) {
- migrate->src[migrate->npages++] = MIGRATE_PFN_MIGRATE;
migrate->dst[migrate->npages] = 0;
+ migrate->src[migrate->npages++] = MIGRATE_PFN_MIGRATE;
migrate->cpages++;
}

--
1.8.3.1
\
 
 \ /
  Last update: 2017-10-02 23:44    [W:0.032 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site