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

Paul Walmsley pjw at kernel.org
Wed Jul 15 10:14:14 PDT 2026


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 at gmail.com>
> Reviewed-by: Nam Cao <namcao at linutronix.de>
> Reviewed-by: Michael Ellerman <mpe at kernel.org>

Thanks, queued for v7.2-rc.


- Paul



More information about the linux-riscv mailing list