All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] nvdimm/pmem: check the validity of the pointer pfn
@ 2018-07-04  6:40 ` Huaisheng Ye
  0 siblings, 0 replies; 21+ messages in thread
From: Huaisheng Ye @ 2018-07-04  6:40 UTC (permalink / raw)
  To: linux-nvdimm
  Cc: axboe, linux-s390, mawilcox, chengnt, jack, heiko.carstens,
	linux-kernel, bart.vanassche, viro, gregkh, schwidefsky,
	linux-fsdevel

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


_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

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

Thread overview: 21+ 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 ` Huaisheng Ye
2018-07-04  6:40 ` [PATCH 2/3] drivers/s390/block/dcssblk: " Huaisheng Ye
2018-07-04  6:40   ` 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  6:40   ` Huaisheng Ye
2018-07-04 11:30   ` Jan Kara
2018-07-04 11:30     ` Jan Kara
2018-07-04 13:07     ` Huaisheng Ye
2018-07-04 13:07       ` Huaisheng Ye
2018-07-04 13:07       ` Huaisheng Ye
2018-07-04 14:37       ` Dan Williams
2018-07-04 14:37         ` Dan Williams
2018-07-04 14:41         ` Dan Williams
2018-07-04 14:41           ` Dan Williams
2018-07-04 15:35           ` [External] " Huaisheng HS1 Ye
2018-07-04 15:35             ` 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 14:40   ` Dan Williams
2018-07-04 15:35   ` [External] " Huaisheng HS1 Ye
2018-07-04 15:35     ` Huaisheng HS1 Ye

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.