summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRyo Nakamura <upa@haeena.net>2022-11-16 01:57:27 +0900
committerRyo Nakamura <upa@haeena.net>2022-11-16 01:57:27 +0900
commit41da0c5cfef8b583cc28ba9bf15897db6b48077e (patch)
treef3ca6c1acf4abfe43372bebcd6da8599733c6ed9 /src
parenta69115a4dc6ee25ba871cf2bd13e7bdb5c4f975d (diff)
check invalid coremask
Diffstat (limited to 'src')
-rw-r--r--src/main.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 1ec8325..2fe8ee9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -174,8 +174,8 @@ int expand_coremask(const char *coremask, int **cores, int *nr_cores)
long v, needle;
/*
- * This function returns array of usabe cores in `cores` and
- * returns the number of usabel cores (array length) through
+ * This function returns array of usable cores in `cores` and
+ * returns the number of usable cores (array length) through
* nr_cores.
*/
@@ -214,6 +214,11 @@ int expand_coremask(const char *coremask, int **cores, int *nr_cores)
}
}
+ if (nr_usable < 1) {
+ pr_err("invalid core mask: %s\n", coremask);
+ return -1;
+ }
+
*cores = core_list;
*nr_cores = nr_usable;
return 0;