]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
libnvdimm, pmem: fix size trim in pmem_direct_access()
authorDan Williams <dan.j.williams@intel.com>
Sun, 25 Oct 2015 02:55:58 +0000 (19:55 -0700)
committerDan Duval <dan.duval@oracle.com>
Wed, 7 Dec 2016 17:25:15 +0000 (12:25 -0500)
Orabug: 22913653

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>
(cherry picked from commit 589e75d15702dc720b363a92f984876704864946)
Signed-off-by: Dan Duval <dan.duval@oracle.com>
drivers/nvdimm/pmem.c

index 9a20100c68796ef98ab67e5fb2c0d52fb8080c76..c76ae77805a6e0b8edf1c36a26ebb10da81ff90e 100644 (file)
@@ -104,22 +104,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 = {