fix: set cpu_* vars to a default value

On ARM64 systems, /proc/cpuinfo uses different field names (CPU implementer,
CPU variant, CPU part, CPU revision) instead of x86-style fields (cpu family,
model, stepping). This left these variables empty, causing printf to fail
with 'invalid number' errors when formatting them as hex values.

Fixes #520.
This commit is contained in:
Stéphane Lesimple
2026-01-25 11:18:23 +01:00
parent 68b4617fd4
commit 8e33a1dbf2

View File

@@ -2309,6 +2309,11 @@ parse_cpu_details()
# if we got no cpu_ucode (e.g. we're in a vm), fall back to 0x0 # if we got no cpu_ucode (e.g. we're in a vm), fall back to 0x0
: "${cpu_ucode:=0x0}" : "${cpu_ucode:=0x0}"
# on non-x86 systems (e.g. ARM), these fields may not exist in cpuinfo, fall back to 0
: "${cpu_family:=0}"
: "${cpu_model:=0}"
: "${cpu_stepping:=0}"
if [ -n "${SMC_MOCK_CPU_UCODE:-}" ]; then if [ -n "${SMC_MOCK_CPU_UCODE:-}" ]; then
cpu_ucode="$SMC_MOCK_CPU_UCODE" cpu_ucode="$SMC_MOCK_CPU_UCODE"
_debug "parse_cpu_details: MOCKING cpu ucode to $cpu_ucode" _debug "parse_cpu_details: MOCKING cpu ucode to $cpu_ucode"