libnvdimm, pfn: Fix over-trim in trim_pfn_device()
authorWei Yang <richardw.yang@linux.intel.com>
Tue, 22 Jan 2019 02:48:09 +0000 (10:48 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Mar 2019 19:09:53 +0000 (20:09 +0100)
commit6a89ed7aa14031a3ba3371e81293dcb5e16d92ec
treece908e254b25b851c8e8352ded37d806f89d5ca5
parent2b88d92ea9d2baef67910564878024d56f233ea7
libnvdimm, pfn: Fix over-trim in trim_pfn_device()

commit f101ada7da6551127d192c2f1742c1e9e0f62799 upstream.

When trying to see whether current nd_region intersects with others,
trim_pfn_device() has already calculated the *size* to be expanded to
SECTION size.

Do not double append 'adjust' to 'size' when calculating whether the end
of a region collides with the next pmem region.

Fixes: ae86cbfef381 "libnvdimm, pfn: Pad pfn namespaces relative to other regions"
Cc: <stable@vger.kernel.org>
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvdimm/pfn_devs.c