linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] nvdimm/pmem: check the validity of the pointer pfn
@ 2018-07-04  6:40 Huaisheng Ye
  2018-07-04  6:40 ` [PATCH 2/3] drivers/s390/block/dcssblk: " Huaisheng Ye
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Huaisheng Ye @ 2018-07-04  6:40 UTC (permalink / raw)
  To: linux-nvdimm
  Cc: dan.j.williams, ross.zwisler, mawilcox, vishal.l.verma,
	dave.jiang, schwidefsky, heiko.carstens, viro, martin.petersen,
	axboe, gregkh, bart.vanassche, jack, chengnt, linux-kernel,
	linux-s390, linux-fsdevel, Huaisheng Ye

From: Huaisheng Ye <yehs1@lenovo.com>

Some functions within fs/dax don't need to get gfn from direct_access.
Assigning NULL to gfn of dax_direct_access is more intuitive and simple
than offering a useless local variable.

So direct_access needs to check validity of the pointer pfn For NULL
assignment.

Signed-off-by: Huaisheng Ye <yehs1@lenovo.com>
---
 drivers/nvdimm/pmem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index 9d71492..018f990 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -233,7 +233,8 @@ __weak long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff,
 					PFN_PHYS(nr_pages))))
 		return -EIO;
 	*kaddr = pmem->virt_addr + offset;
-	*pfn = phys_to_pfn_t(pmem->phys_addr + offset, pmem->pfn_flags);
+	if (pfn)
+		*pfn = phys_to_pfn_t(pmem->phys_addr + offset, pmem->pfn_flags);
 
 	/*
 	 * If badblocks are present, limit known good range to the
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-07-04 15:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-04  6:40 [PATCH 1/3] nvdimm/pmem: check the validity of the pointer pfn Huaisheng Ye
2018-07-04  6:40 ` [PATCH 2/3] drivers/s390/block/dcssblk: " Huaisheng Ye
2018-07-04  6:40 ` [PATCH 3/3] fs/dax: Assigning NULL to gfn of dax_direct_access if useless Huaisheng Ye
2018-07-04 11:30   ` Jan Kara
2018-07-04 13:07     ` Huaisheng Ye
2018-07-04 14:37       ` Dan Williams
2018-07-04 14:41         ` Dan Williams
2018-07-04 15:35           ` [External] " Huaisheng HS1 Ye
2018-07-04 14:40 ` [PATCH 1/3] nvdimm/pmem: check the validity of the pointer pfn Dan Williams
2018-07-04 15:35   ` [External] " Huaisheng HS1 Ye

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).