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:
Petr Holasek 2011-10-06 11:57:45 -04:00 committed by Neil Horman
parent 93f959c9a6
commit 80157dd69a

View file

@ -154,7 +154,7 @@ assign_node:
lcpu_mask = NULL;
rc = fscanf(fd, "%as", &lcpu_mask);
fclose(fd);
if (!lcpu_mask) {
if (!lcpu_mask || !rc) {
cpus_setall(new->cpumask);
} else {
cpumask_parse_user(lcpu_mask, strlen(lcpu_mask),