Blob Blame History Raw
diff --git a/cputree.c b/cputree.c
index fbd03b5..c5ae645 100644
--- a/cputree.c
+++ b/cputree.c
@@ -88,7 +88,8 @@ static void setup_banned_cpus(void)
 		goto cmdline;
 
 	if (getline(&line, &size, file) > 0) {
-		cpulist_parse(line, size, nohz_full);
+		if (strlen(line) && line[0] != '\n')
+			cpulist_parse(line, strlen(line), nohz_full);
 		free(line);
 		line = NULL;
 		size = 0;
@@ -98,7 +99,8 @@ static void setup_banned_cpus(void)
 	file = fopen("/sys/devices/system/cpu/isolated", "r");
 	if (file) {
 		if (getline(&line, &size, file) > 0) {
-			cpulist_parse(line, size, isolated_cpus);
+			if (strlen(line) && line[0] != '\n')
+				cpulist_parse(line, strlen(line), isolated_cpus);
 			free(line);
 			line = NULL;
 			size = 0;