mm: Fix memory size alignment in devm_memremap_pages_release()
authorJan H. Schönherr <jschoenh@amazon.de>
Sat, 20 Jan 2018 00:27:54 +0000 (16:27 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Feb 2018 14:43:48 +0000 (15:43 +0100)
commitcbd0c0fc54e2fa27d05779cb984fe9c989652be8
tree9bb2b1498ab5c4e7b3d0365485b30364c57c43a4
parent7318454518ad56ad38b60dbb3d185fd14d0d0b93
mm: Fix memory size alignment in devm_memremap_pages_release()

commit 10a0cd6e4932b5078215b1ec2c896597eec0eff9 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/memremap.c