From: Dave Jiang <dave.jiang@intel.com>
To: John Groves <john@jagalactic.com>, Dan Williams <djbw@kernel.org>,
Vishal Verma <vishal.l.verma@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
"nvdimm@lists.linux.dev" <nvdimm@lists.linux.dev>,
"linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Dan Carpenter <dan.carpenter@linaro.org>,
John Groves <John@Groves.net>
Subject: Re: [PATCH] dax/fsdev: fix uninitialized kaddr in fsdev_dax_zero_page_range()
Date: Mon, 13 Apr 2026 09:12:16 -0700 [thread overview]
Message-ID: <5946384b-e35c-460d-8b2c-4e995b1c07e3@intel.com> (raw)
In-Reply-To: <0100019d8262cda2-9714d31c-8fc1-4ca5-b32d-4df678240d14-000000@email.amazonses.com>
On 4/12/26 8:50 AM, John Groves wrote:
> From: John Groves <John@Groves.net>
>
> __fsdev_dax_direct_access() returns -EFAULT without setting *kaddr when
> dax_pgoff_to_phys() returns -1 (pgoff out of range). The return value
> was ignored, leaving kaddr uninitialized before being passed to
> fsdev_write_dax().
>
> Check the return value and propagate the error.
>
> Thanks to Dan Carpenter and the smatch project for reporting this.
>
> Signed-off-by: John Groves <john@groves.net>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
> drivers/dax/fsdev.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dax/fsdev.c b/drivers/dax/fsdev.c
> index 4499d9621f33..188b2526bee4 100644
> --- a/drivers/dax/fsdev.c
> +++ b/drivers/dax/fsdev.c
> @@ -80,9 +80,12 @@ static int fsdev_dax_zero_page_range(struct dax_device *dax_dev,
> pgoff_t pgoff, size_t nr_pages)
> {
> void *kaddr;
> + long rc;
>
> WARN_ONCE(nr_pages > 1, "%s: nr_pages > 1\n", __func__);
> - __fsdev_dax_direct_access(dax_dev, pgoff, 1, DAX_ACCESS, &kaddr, NULL);
> + rc = __fsdev_dax_direct_access(dax_dev, pgoff, 1, DAX_ACCESS, &kaddr, NULL);
> + if (rc < 0)
> + return rc;
> fsdev_write_dax(kaddr, ZERO_PAGE(0), 0, PAGE_SIZE);
> return 0;
> }
>
> base-commit: 2ae624d5a555d47a735fb3f4d850402859a4db77
prev parent reply other threads:[~2026-04-13 16:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260412154944.461748-1-john@jagalactic.com>
2026-04-12 15:50 ` [PATCH] dax/fsdev: fix uninitialized kaddr in fsdev_dax_zero_page_range() John Groves
2026-04-13 15:19 ` Jonathan Cameron
2026-04-13 16:12 ` Dave Jiang [this message]
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=5946384b-e35c-460d-8b2c-4e995b1c07e3@intel.com \
--to=dave.jiang@intel.com \
--cc=John@Groves.net \
--cc=dan.carpenter@linaro.org \
--cc=djbw@kernel.org \
--cc=ira.weiny@intel.com \
--cc=john@jagalactic.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@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