From: sashiko-bot@kernel.org
To: "Gregory Price" <gourry@gourry.net>
Cc: linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev
Subject: Re: [PATCH v5 6/9] dax: plumb hotplug online_type through dax
Date: Wed, 24 Jun 2026 15:12:14 +0000 [thread overview]
Message-ID: <20260624151214.974611F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260624145744.3532049-7-gourry@gourry.net>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Assigning DAX_ONLINE_DEFAULT (-1) to enum mmop triggers UBSan out-of-bounds violation.
--
commit e0320ba16dade8553731440e4c066c6a7c836047
Author: Gregory Price <gourry@gourry.net>
dax: plumb hotplug online_type through dax
There is no way for drivers leveraging dax_kmem to plumb through a
preferred auto-online policy - the system default policy is forced.
Add 'enum mmop' field to DAX device creation path to allow drivers
to specify an auto-online policy when using the kmem driver.
> diff --git a/drivers/dax/bus.h b/drivers/dax/bus.h
> index 5909171a4428b..f3c9dae5de6ba 100644
> --- a/drivers/dax/bus.h
> +++ b/drivers/dax/bus.h
> @@ -16,6 +17,13 @@ struct dax_region;
> #define IORESOURCE_DAX_STATIC BIT(0)
> #define IORESOURCE_DAX_KMEM BIT(1)
>
> +/*
> + * online_type sentinel: the device was created without an explicit online
> + * policy, so the system default is resolved when the kmem driver binds,
> + * (not at device-creation time, which would freeze a stale policy).
> + */
> +#define DAX_ONLINE_DEFAULT (-1)
> +
> struct dax_region *alloc_dax_region(struct device *parent, int region_id,
> struct range *range, int target_node, unsigned int align,
> unsigned long flags);
> @@ -26,6 +34,7 @@ struct dev_dax_data {
> resource_size_t size;
> int id;
> bool memmap_on_memory;
> + enum mmop online_type;
[Severity: Medium]
Can this declaration cause an out-of-bounds UBSan violation when assigned
DAX_ONLINE_DEFAULT? DAX_ONLINE_DEFAULT is defined as -1, but enum mmop only
has a valid range from 0 to 3.
> };
[ ... ]
> diff --git a/drivers/dax/dax-private.h b/drivers/dax/dax-private.h
> index 81e4af49e39c1..ccd77965fe3ed 100644
> --- a/drivers/dax/dax-private.h
> +++ b/drivers/dax/dax-private.h
> @@ -95,6 +98,7 @@ struct dev_dax {
> struct device dev;
> struct dev_pagemap *pgmap;
> bool memmap_on_memory;
> + enum mmop online_type;
[Severity: Medium]
Does this struct member also need to be an int instead of enum mmop to safely
store the -1 sentinel value?
> int nr_range;
> struct dev_dax_range *ranges;
> };
[ ... ]
> diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c
> index 592171ec10f49..0a184c0878ddf 100644
> --- a/drivers/dax/kmem.c
> +++ b/drivers/dax/kmem.c
> @@ -132,6 +133,11 @@ static int dev_dax_kmem_probe(struct dev_dax *dev_dax)
> goto err_reg_mgid;
> data->mgid = rc;
>
> + /* Resolve system default at bind time in case it changed */
> + online_type = dev_dax->online_type;
[Severity: Medium]
Could loading dev_dax->online_type here when it is set to -1 trigger a UBSan
out-of-bounds violation during probe?
> + if (online_type == DAX_ONLINE_DEFAULT)
> + online_type = mhp_get_default_online_type();
> +
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260624145744.3532049-1-gourry@gourry.net?part=6
next prev parent reply other threads:[~2026-06-24 15:12 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-24 14:57 [PATCH v5 0/9] dax/kmem: atomic whole-device hotplug via sysfs Gregory Price
2026-06-24 14:57 ` [PATCH v5 1/9] mm/memory: add memory_block_aligned_range() helper Gregory Price
2026-06-24 15:08 ` sashiko-bot
2026-06-24 14:57 ` [PATCH v5 2/9] mm/memory_hotplug: pass online_type to online_memory_block() via arg Gregory Price
2026-06-24 16:28 ` Gupta, Pankaj
2026-06-24 14:57 ` [PATCH v5 3/9] mm/memory_hotplug: export mhp_get_default_online_type Gregory Price
2026-06-24 14:57 ` [PATCH v5 4/9] mm/memory_hotplug: add __add_memory_driver_managed() with online_type arg Gregory Price
2026-06-24 16:41 ` Gupta, Pankaj
2026-06-24 14:57 ` [PATCH v5 5/9] mm/memory_hotplug: offline_and_remove_memory_ranges() Gregory Price
2026-06-24 15:11 ` sashiko-bot
2026-06-24 14:57 ` [PATCH v5 6/9] dax: plumb hotplug online_type through dax Gregory Price
2026-06-24 15:12 ` sashiko-bot [this message]
2026-06-24 14:57 ` [PATCH v5 7/9] dax/kmem: extract hotplug/hotremove helper functions Gregory Price
2026-06-24 15:09 ` sashiko-bot
2026-06-24 14:57 ` [PATCH v5 8/9] dax/kmem: add sysfs interface for atomic whole-device hotplug Gregory Price
2026-06-24 15:11 ` sashiko-bot
2026-06-24 14:57 ` [PATCH v5 9/9] selftests/dax: add dax/kmem hotplug sysfs regression test Gregory Price
2026-06-24 15:12 ` sashiko-bot
2026-06-24 18:59 ` [PATCH v5 0/9] dax/kmem: atomic whole-device hotplug via sysfs Gregory Price
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=20260624151214.974611F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=gourry@gourry.net \
--cc=linux-cxl@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/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