On 2026-10-29 16:44 -0700, Alison Schofield wrote:
> memblock_in_dev() treats a DAX device as one contiguous physical address
> range, even when the device has multiple ranges separated by gaps. This
> misses blocks in later ranges and may incorrectly include blocks belonging
> to another device.
>
> Memory block counts and per-block online/offline operations use this
> lookup, so daxctl may operate on memory outside the requested device.
>
> Match blocks against each individual mapping, retaining the single-range
> fallback for older kernels. Reset errno before each readdir() so a stale
> ENOENT from the mapping lookup is not reported as a directory read error.
>
> Fixes: e8bf803e359b ("libdaxctl: add a 'daxctl_memory' object for memory
> based operations")
> Signed-off-by: Alison Schofield <[email protected]>
Reviewed-by: Gregory Price (Meta) <[email protected]>
--
~Gregory