Blame SOURCES/0173-chcpu-Fix-maximal-number-of-CPUs.patch

5113bc
From 72e09b02e7b4cf3e9e77ef02d5073d9a11f3b314 Mon Sep 17 00:00:00 2001
5113bc
From: Stanislav Brabec <sbrabec@suse.cz>
5113bc
Date: Wed, 9 May 2018 22:13:07 +0200
5113bc
Subject: [PATCH 173/173] chcpu: Fix maximal number of CPUs
5113bc
5113bc
chcpu.c mixed maxcpus (number of cpus) and setsize (size of CPU bit
5113bc
mask). It effectively limits number of CPUs to 1/8 of the supported
5113bc
amount.
5113bc
5113bc
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
5113bc
Cc: Michael Matz <matz@suse.de>
5113bc
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
5113bc
Upstream: http://github.com/karelzak/util-linux/commit/607274943bfd3d4856b872bc4278b36903fb2182
5113bc
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1579439
5113bc
---
5113bc
 sys-utils/chcpu.c | 16 ++++++++--------
5113bc
 1 file changed, 8 insertions(+), 8 deletions(-)
5113bc
5113bc
diff --git a/sys-utils/chcpu.c b/sys-utils/chcpu.c
5113bc
index 7843dfb22..1a0157360 100644
5113bc
--- a/sys-utils/chcpu.c
5113bc
+++ b/sys-utils/chcpu.c
5113bc
@@ -75,12 +75,12 @@ enum {
5113bc
  */
5113bc
 static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable)
5113bc
 {
5113bc
-	unsigned int cpu;
5113bc
+	int cpu;
5113bc
 	int online, rc;
5113bc
 	int configured = -1;
5113bc
-	size_t fails = 0;
5113bc
+	int fails = 0;
5113bc
 
5113bc
-	for (cpu = 0; cpu < setsize; cpu++) {
5113bc
+	for (cpu = 0; cpu < maxcpus; cpu++) {
5113bc
 		if (!CPU_ISSET_S(cpu, setsize, cpu_set))
5113bc
 			continue;
5113bc
 		if (!path_exist(_PATH_SYS_CPU "/cpu%d", cpu)) {
5113bc
@@ -132,7 +132,7 @@ static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable)
5113bc
 		}
5113bc
 	}
5113bc
 
5113bc
-	return fails == 0 ? 0 : fails == setsize ? -1 : 1;
5113bc
+	return fails == 0 ? 0 : fails == maxcpus ? -1 : 1;
5113bc
 }
5113bc
 
5113bc
 static int cpu_rescan(void)
5113bc
@@ -168,11 +168,11 @@ static int cpu_set_dispatch(int mode)
5113bc
  */
5113bc
 static int cpu_configure(cpu_set_t *cpu_set, size_t setsize, int configure)
5113bc
 {
5113bc
-	unsigned int cpu;
5113bc
+	int cpu;
5113bc
 	int rc, current;
5113bc
-	size_t fails = 0;
5113bc
+	int fails = 0;
5113bc
 
5113bc
-	for (cpu = 0; cpu < setsize; cpu++) {
5113bc
+	for (cpu = 0; cpu < maxcpus; cpu++) {
5113bc
 		if (!CPU_ISSET_S(cpu, setsize, cpu_set))
5113bc
 			continue;
5113bc
 		if (!path_exist(_PATH_SYS_CPU "/cpu%d", cpu)) {
5113bc
@@ -217,7 +217,7 @@ static int cpu_configure(cpu_set_t *cpu_set, size_t setsize, int configure)
5113bc
 		}
5113bc
 	}
5113bc
 
5113bc
-	return fails == 0 ? 0 : fails == setsize ? -1 : 1;
5113bc
+	return fails == 0 ? 0 : fails == maxcpus ? -1 : 1;
5113bc
 }
5113bc
 
5113bc
 static void cpu_parse(char *cpu_string, cpu_set_t *cpu_set, size_t setsize)
5113bc
-- 
5113bc
2.14.4
5113bc