summaryrefslogtreecommitdiffstats
path: root/kernel/memremap.c
diff options
context:
space:
mode:
authorJan H. Schönherr <jschoenh@amazon.de>2018-01-19 19:27:54 -0500
committerDan Williams <dan.j.williams@intel.com>2018-01-19 19:29:48 -0500
commit10a0cd6e4932b5078215b1ec2c896597eec0eff9 (patch)
treeebe957829554ccf069566daa5c8ab68e4b346d4a /kernel/memremap.c
parente697c5b90e97792187e45f8d78fb2bfa62eb0496 (diff)
mm: Fix memory size alignment in devm_memremap_pages_release()
The functions devm_memremap_pages() and devm_memremap_pages_release() use different ways to calculate the section-aligned amount of memory. The latter function may use an incorrect size if the memory region is small but straddles a section border. Use the same code for both. Cc: <stable@vger.kernel.org> Fixes: 5f29a77cd957 ("mm: fix mixed zone detection in devm_memremap_pages") Signed-off-by: Jan H. Schönherr <jschoenh@amazon.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'kernel/memremap.c')
-rw-r--r--kernel/memremap.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/memremap.c b/kernel/memremap.c
index ada31b0d76d4..4ef97525a4ff 100644
--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -293,7 +293,8 @@ static void devm_memremap_pages_release(void *data)
293 293
294 /* pages are dead and unused, undo the arch mapping */ 294 /* pages are dead and unused, undo the arch mapping */
295 align_start = res->start & ~(SECTION_SIZE - 1); 295 align_start = res->start & ~(SECTION_SIZE - 1);
296 align_size = ALIGN(resource_size(res), SECTION_SIZE); 296 align_size = ALIGN(res->start + resource_size(res), SECTION_SIZE)
297 - align_start;
297 298
298 mem_hotplug_begin(); 299 mem_hotplug_begin();
299 arch_remove_memory(align_start, align_size, pgmap->altmap_valid ? 300 arch_remove_memory(align_start, align_size, pgmap->altmap_valid ?