[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <456a021c7ef3636d7668cec9dcb4a446a4244812.1609855564.git.jstancek@redhat.com>
Date: Tue, 5 Jan 2021 15:14:20 +0100
From: Jan Stancek <jstancek@...hat.com>
To: linux-mm@...ck.org, linux-kernel@...r.kernel.org
Cc: ziy@...dia.com, shy828301@...il.com, jack@...e.cz,
willy@...radead.org, mgorman@...e.de, mhocko@...e.com,
songliubraving@...com, akpm@...ux-foundation.org,
jstancek@...hat.com
Subject: [PATCH] mm: migrate: initialize err in do_migrate_pages
After commit 236c32eb1096 ("mm: migrate: clean up migrate_prep{_local}")',
do_migrate_pages can return uninitialized variable 'err' (which is
propagated to user-space as error) when 'from' and 'to' nodesets
are identical. This can be reproduced with LTP migrate_pages01,
which calls migrate_pages() with same set for both old/new_nodes.
Add 'err' initialization back.
Fixes: 236c32eb1096 ("mm: migrate: clean up migrate_prep{_local}")
Cc: Zi Yan <ziy@...dia.com>
Cc: Yang Shi <shy828301@...il.com>
Cc: Jan Kara <jack@...e.cz>
Cc: Matthew Wilcox <willy@...radead.org>
Cc: Mel Gorman <mgorman@...e.de>
Cc: Michal Hocko <mhocko@...e.com>
Cc: Song Liu <songliubraving@...com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Jan Stancek <jstancek@...hat.com>
---
mm/mempolicy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 8cf96bd21341..2c3a86502053 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1111,7 +1111,7 @@ int do_migrate_pages(struct mm_struct *mm, const nodemask_t *from,
const nodemask_t *to, int flags)
{
int busy = 0;
- int err;
+ int err = 0;
nodemask_t tmp;
migrate_prep();
--
2.18.1
Powered by blists - more mailing lists