diff --git a/libcpuid/cpuid_main.c b/libcpuid/cpuid_main.c index 3c7d604..9aaa892 100644 --- a/libcpuid/cpuid_main.c +++ b/libcpuid/cpuid_main.c @@ -1352,7 +1352,7 @@ int cpu_identify_all(struct cpu_raw_data_array_t* raw_array, struct system_id_t* } else { /* Note: if SMT is disabled by BIOS, smt_divisor will no reflect the current state properly */ - is_smt_supported = (system->cpu_types[cpu_type_index].num_logical_cpus % system->cpu_types[cpu_type_index].num_cores) == 0; + is_smt_supported = system->cpu_types[cpu_type_index].num_cores > 0 ? (system->cpu_types[cpu_type_index].num_logical_cpus % system->cpu_types[cpu_type_index].num_cores) == 0 : false; smt_divisor = is_smt_supported ? system->cpu_types[cpu_type_index].num_logical_cpus / system->cpu_types[cpu_type_index].num_cores : 1.0; system->cpu_types[cpu_type_index].num_cores = (int32_t) num_logical_cpus / smt_divisor; }