diff options
author | Dan Williams <dan.j.williams@intel.com> | 2015-10-24 19:55:58 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2015-11-12 09:55:23 -0800 |
commit | 589e75d15702dc720b363a92f984876704864946 (patch) | |
tree | 82d183895174d8e151f84cbf0e4f0d2436301f7d /drivers/nvdimm | |
parent | f7256dc0cdbc68903502997bde619f555a910f50 (diff) | |
download | lwn-589e75d15702dc720b363a92f984876704864946.tar.gz lwn-589e75d15702dc720b363a92f984876704864946.zip |
libnvdimm, pmem: fix size trim in pmem_direct_access()
This masking prevents access to the end of the device via dax_do_io(),
and is unnecessary as arch_add_memory() would have rejected an unaligned
allocation.
Cc: <stable@vger.kernel.org>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm')
-rw-r--r-- | drivers/nvdimm/pmem.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 012e0649f1ac..8ee79893d2f5 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -105,22 +105,11 @@ static long pmem_direct_access(struct block_device *bdev, sector_t sector, { struct pmem_device *pmem = bdev->bd_disk->private_data; resource_size_t offset = sector * 512 + pmem->data_offset; - resource_size_t size; - - if (pmem->data_offset) { - /* - * Limit the direct_access() size to what is covered by - * the memmap - */ - size = (pmem->size - offset) & ~ND_PFN_MASK; - } else - size = pmem->size - offset; - - /* FIXME convert DAX to comprehend that this mapping has a lifetime */ + *kaddr = pmem->virt_addr + offset; *pfn = (pmem->phys_addr + offset) >> PAGE_SHIFT; - return size; + return pmem->size - offset; } static const struct block_device_operations pmem_fops = { |