mirror-linux/arch/riscv
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
..
boot Networking changes for 6.18. 2025-10-02 15:17:01 -07:00
configs RISC-V updates for the v6.18 merge window (part two) 2025-10-04 10:36:22 -07:00
crypto lib/crypto: riscv/sha512: Migrate optimized SHA-512 code to library 2025-06-30 09:26:19 -07:00
errata riscv: errata: Fix the PAUSE Opcode for MIPS P8700 2025-09-19 10:33:56 -06:00
include riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot 2025-10-17 22:23:11 -06:00
kernel riscv: hwprobe: avoid uninitialized variable use in hwprobe_arch_id() 2025-10-18 09:36:36 -06:00
kvm hyperv-next for v6.18 2025-10-07 08:40:15 -07:00
lib Crypto library updates for 6.17 2025-07-28 17:58:52 -07:00
mm Summary of significant series in this pull request: 2025-10-02 18:18:33 -07:00
net bpf-next-6.18 2025-09-30 17:58:11 -07:00
purgatory kcfi: Rename CONFIG_CFI_CLANG to CONFIG_CFI 2025-09-24 14:29:14 -07:00
tools riscv: Stop considering R_RISCV_NONE as bad relocations 2025-07-16 08:13:55 -07:00
Kbuild riscv: migrate to the generic rule for built-in DTB 2025-03-18 13:30:13 +00:00
Kconfig riscv: Respect dependencies of ARCH_HAS_ELF_CORE_EFLAGS 2025-10-09 19:39:05 -06:00
Kconfig.debug
Kconfig.errata riscv: errata: Fix the PAUSE Opcode for MIPS P8700 2025-09-19 10:33:56 -06:00
Kconfig.socs riscv: Add Kconfig option for ESWIN platforms 2025-09-25 08:29:05 +02:00
Kconfig.vendor riscv: Add xmipsexectl as a vendor extension 2025-09-18 20:36:00 -06:00
Makefile riscv: Unconditionally use linker relaxation 2025-08-28 16:58:45 -07:00
Makefile.postlink kbuild: Create intermediate vmlinux build with relocations preserved 2025-03-17 00:29:50 +09:00