nvdimm: fix PHYS_PFN/PFN_PHYS mixup
PATCH 1/1 nvdimm: fix PHYS_PFN/PFN_PHYS mixup
nd_activate_region() iomaps any hint addresses required when activating a region. To prevent duplicate mappings it checks the PFN of the hint to be mapped against the PFNs of the already mapped hints. Unfortunately it doesn't convert the PFN back into a physical address before passing it to devm_nvdimm_ioremap(). Instead it applies PHYS_PFN a second time which ends about as well as you would imagine.
--- drivers/nvdimm/region_devs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvdimm/region_devs.c +1 -1
@@ -57,7 +57,7 @@ static int nvdimm_map_flush(struct device *dev, struct nvdimm *nvdimm, int dimm, ndrd->flush_wpq[dimm][j] & PAGE_MASK); else flush_page =devm_nvdimm_ioremap (dev, -PHYS_PFN (pfn),PAGE_SIZE ); +PFN_PHYS (pfn),PAGE_SIZE );if (!flush_page)return -ENXIO ; ndrd->flush_wpq[dimm][i] = flush_page
Signature · 6 lines
2.5.5 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Quoted 18 lines · Oliver O'Halloran
nd_activate_region()iomaps any hint addresses required when activating a region. To prevent duplicate mappings it checks the PFN of the hint to be mapped against the PFNs of the already mapped hints. Unfortunately it doesn't convert the PFN back into a physical address before passing it todevm_nvdimm_ioremap(). Instead it appliesPHYS_PFNa second time which ends about as well as you would imagine.Signed-off-by Oliver O'Halloran <[email protected]>Cc Dan Williams <[email protected]>--- drivers/nvdimm/region_devs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/nvdimm/region_devs.c +0
-0
drivers/nvdimm/region_devs.c static int nvdimm_map_flush(struct device *dev, struct nvdimm *nvdimm, int dimm, · line 63
Quoted 8 lines
drivers/nvdimm/region_devs.c +1
-1@@ -57,7 +57,7 @@ static int nvdimm_map_flush(struct device *dev, struct nvdimm *nvdimm, int dimm, ndrd->flush_wpq[dimm][j] & PAGE_MASK); else flush_page =devm_nvdimm_ioremap (dev, -PHYS_PFN (pfn),PAGE_SIZE ); +PFN_PHYS (pfn),PAGE_SIZE );if (!flush_page)return -ENXIO ; ndrd->flush_wpq[dimm][i] = flush_page
Nice catch, I'll push this for 4.8-final.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm