Re: [PATCH v2] riscv: hwprobe: Avoid uninitialized read in hwprobe_get_cpus()

From: Paul Walmsley

Date: Wed Jul 15 2026 - 13:14:31 EST


On Mon, 13 Jul 2026, Mark Harris wrote:

> When cpusetsize < cpumask_size(), hwprobe_get_cpus() did not fully
> initialize its copy of the cpu mask, which could cause non-deterministic
> results from the riscv_hwprobe syscall on a system with more than 8 CPUs
> when the supplied cpu mask is empty. Address this by fully initializing
> the cpu mask.
>
> Fixes: e178bf146e4b ("RISC-V: hwprobe: Introduce which-cpus flag")
> Signed-off-by: Mark Harris <mark.hsj@xxxxxxxxx>
> Reviewed-by: Nam Cao <namcao@xxxxxxxxxxxxx>
> Reviewed-by: Michael Ellerman <mpe@xxxxxxxxxx>

Thanks, queued for v7.2-rc.


- Paul