From: Dave Jiang <dave.jiang@intel.com>
To: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org
Cc: dan.j.williams@intel.com, vishal.l.verma@intel.com, ira.weiny@intel.com
Subject: [PATCH] dax: Add direct_access() callback check for dax_direct_access()
Date: Fri, 6 Mar 2026 16:05:07 -0700 [thread overview]
Message-ID: <20260306230507.2149965-1-dave.jiang@intel.com> (raw)
__devm_create_dev_dax() calls alloc_dax() with the ops parameter passed
in as NULL. Therefore the ops pointer in dev_dax can be NULL. Add a
check in dax_direct_access() for ops and ops->direct_access() before
calling ops->direct_access().
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
drivers/dax/super.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/dax/super.c b/drivers/dax/super.c
index c00b9dff4a06..5cebaf11a58e 100644
--- a/drivers/dax/super.c
+++ b/drivers/dax/super.c
@@ -160,6 +160,9 @@ long dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages,
if (nr_pages < 0)
return -EINVAL;
+ if (!dax_dev->ops || !dax_dev->ops->direct_access)
+ return -EOPNOTSUPP;
+
avail = dax_dev->ops->direct_access(dax_dev, pgoff, nr_pages,
mode, kaddr, pfn);
if (!avail)
base-commit: 11439c4635edd669ae435eec308f4ab8a0804808
--
2.53.0
next reply other threads:[~2026-03-06 23:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-06 23:05 Dave Jiang [this message]
2026-03-09 16:58 ` [PATCH] dax: Add direct_access() callback check for dax_direct_access() Ira Weiny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260306230507.2149965-1-dave.jiang@intel.com \
--to=dave.jiang@intel.com \
--cc=dan.j.williams@intel.com \
--cc=ira.weiny@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox