1
0
Fork 0
mirror of https://github.com/anrieff/libcpuid synced 2024-11-10 22:59:13 +00:00

Fix scanf() format for 'logical_cpu' in cpuid_deserialize_raw_data_internal()

logical_cpu is an uint16_t, so SCNu16 is the correct format. It was providing strange values with SCNi16, like with the Intel® Xeon® Platinum 8280 dump.
This commit is contained in:
The Tumultuous Unicorn Of Darkness 2024-07-31 14:32:15 +02:00
parent 25c83f0d0b
commit 543c3ac17d
No known key found for this signature in database
GPG key ID: 1E55EE2EFF18BC1A
2 changed files with 9 additions and 9 deletions

View file

@ -806,7 +806,7 @@ static int cpuid_deserialize_raw_data_internal(struct cpu_raw_data_t* single_raw
}
if (is_libcpuid_dump) {
if (use_raw_array && (sscanf(line, "_________________ Logical CPU #%" SCNi16 " _________________", &logical_cpu) >= 1)) {
if (use_raw_array && (sscanf(line, "_________________ Logical CPU #%" SCNu16 " _________________", &logical_cpu) >= 1)) {
debugf(2, "Parsing raw dump for logical CPU %i\n", logical_cpu);
is_header = false;
cpuid_grow_raw_data_array(raw_array, logical_cpu + 1);
@ -887,9 +887,9 @@ static int cpuid_deserialize_raw_data_internal(struct cpu_raw_data_t* single_raw
}
}
else if (is_aida64_dump) {
if (use_raw_array && ((sscanf(line, "------[ Logical CPU #%" SCNi16 " ]------", &logical_cpu) >= 1) ||
(sscanf(line, "------[ CPUID Registers / Logical CPU #%" SCNi16 " ]------", &logical_cpu) >= 1) ||
(sscanf(line, "CPU#%" SCNi16 " AffMask: 0x%*x", &logical_cpu) >= 1))) {
if (use_raw_array && ((sscanf(line, "------[ Logical CPU #%" SCNu16 " ]------", &logical_cpu) >= 1) ||
(sscanf(line, "------[ CPUID Registers / Logical CPU #%" SCNu16 " ]------", &logical_cpu) >= 1) ||
(sscanf(line, "CPU#%" SCNu16 " AffMask: 0x%*x", &logical_cpu) >= 1))) {
debugf(2, "Parsing AIDA64 raw dump for logical CPU %i\n", logical_cpu);
cpuid_grow_raw_data_array(raw_array, logical_cpu + 1);
raw_ptr = &raw_array->raw[logical_cpu];

View file

@ -2751,8 +2751,8 @@ general
7
6
85
26
46
28
56
32
32
1024
@ -2768,9 +2768,9 @@ general
64
64
-1
26
26
26
28
28
28
1
0
128 (non-authoritative)