Files
linux/arch/riscv/kernel
Paul Walmsley b7776a802f riscv: hwprobe: avoid uninitialized variable use in hwprobe_arch_id()
Resolve this smatch warning:

  arch/riscv/kernel/sys_hwprobe.c:50 hwprobe_arch_id() error: uninitialized symbol 'cpu_id'.

This could happen if hwprobe_arch_id() was called with a key ID of
something other than MVENDORID, MIMPID, and MARCHID.  This does not
happen in the current codebase.  The only caller of hwprobe_arch_id()
is a function that only passes one of those three key IDs.

For the sake of reducing static analyzer warning noise, and in the
unlikely event that hwprobe_arch_id() is someday called with some
other key ID, validate hwprobe_arch_id()'s input to ensure that
'cpu_id' is always initialized before use.

Fixes: ea3de9ce8a ("RISC-V: Add a syscall for HW probing")
Cc: Evan Green <evan@rivosinc.com>
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Link: https://lore.kernel.org/r/cf5a13ec-19d0-9862-059b-943f36107bf3@kernel.org
2025-10-18 09:36:36 -06:00
..
2025-01-18 12:33:39 -08:00
2025-05-21 16:46:37 +02:00
2023-03-23 08:47:00 -07:00
2025-06-26 16:06:40 +02:00
2024-11-07 14:25:15 -08:00
2022-05-19 19:30:30 +02:00
2024-09-03 07:57:55 -07:00
2025-02-14 13:06:44 -08:00
2025-04-01 07:03:03 +00:00
2021-01-07 19:00:50 -08:00
2025-03-18 12:59:03 +00:00
2025-06-05 14:03:08 -07:00
2025-09-16 16:28:02 -06:00