benchmarks/hectic: fix infinite loop in CPU list parser

This commit is contained in:
Philippe Gerum 2020-01-08 17:41:41 +01:00
parent b5ba72a91a
commit f43fbd158a
1 changed files with 2 additions and 1 deletions

View File

@ -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;
} }