mm/migrate: Fix early increment of migrate->npages
Subsystems (2)
PATCH 1/1 mm/migrate: Fix early increment of migrate->npages
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 JA(C)rA'me Glisse <[email protected]>
Signed-off-by Reza Arbab <[email protected]>
--- mm/migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/migrate.c +1 -1
@@ -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++; }
Signature · 7 lines
1.8.3.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines · Reza Arbab
The intention here is to set the same array element in src and dst. Switch the order of these lines so that
migrate->npagesis only incremented after we've used it.
I already posted a fix for this today from Mark. Either version is fine i think Andrew already pulled version i posted earlier.
Quoted 25 lines
Fixes 8315ada7f095 ("mm/migrate: allow migrate_vma() to alloc new page on empty entry")Cc Jerome Glisse <[email protected]>Signed-off-by Reza Arbab <[email protected]>--- mm/migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/migrate.c +1
-1@@ -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++; }Signature · 1 line
1.8.3.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>