benchmarks/hectic: fix infinite loop in CPU list parser
This commit is contained in:
parent
b5ba72a91a
commit
f43fbd158a
|
@ -1090,7 +1090,7 @@ static void build_cpu_mask(const char *cpu_list)
|
||||||
s = n = strdup(cpu_list);
|
s = n = strdup(cpu_list);
|
||||||
while ((range = strtok_r(n, ",", &range_p)) != NULL) {
|
while ((range = strtok_r(n, ",", &range_p)) != NULL) {
|
||||||
if (*range == '\0' || *range == '\n')
|
if (*range == '\0' || *range == '\n')
|
||||||
continue;
|
goto next;
|
||||||
end = -1;
|
end = -1;
|
||||||
if (range[strlen(range)-1] == '-')
|
if (range[strlen(range)-1] == '-')
|
||||||
end = max_cpus - 1;
|
end = max_cpus - 1;
|
||||||
|
@ -1115,6 +1115,7 @@ static void build_cpu_mask(const char *cpu_list)
|
||||||
}
|
}
|
||||||
for (cpu = start; cpu <= end; cpu++)
|
for (cpu = start; cpu <= end; cpu++)
|
||||||
CPU_SET(cpu, &cpu_affinity);
|
CPU_SET(cpu, &cpu_affinity);
|
||||||
|
next:
|
||||||
n = NULL;
|
n = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue