Fix a crash resulting from trying to parse a misread cpumask.
If we don't read a cpumask from the local_cpus sysfs file, we shouldn't try to parse it Signed-off-by: Petr Holasek <pholasek@redhat.com> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
This commit is contained in:
parent
93f959c9a6
commit
80157dd69a
|
@ -154,7 +154,7 @@ assign_node:
|
||||||
lcpu_mask = NULL;
|
lcpu_mask = NULL;
|
||||||
rc = fscanf(fd, "%as", &lcpu_mask);
|
rc = fscanf(fd, "%as", &lcpu_mask);
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
if (!lcpu_mask) {
|
if (!lcpu_mask || !rc) {
|
||||||
cpus_setall(new->cpumask);
|
cpus_setall(new->cpumask);
|
||||||
} else {
|
} else {
|
||||||
cpumask_parse_user(lcpu_mask, strlen(lcpu_mask),
|
cpumask_parse_user(lcpu_mask, strlen(lcpu_mask),
|
||||||
|
|
Loading…
Reference in a new issue