lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20201217153434.10945-2-jiangshanlai@gmail.com>
Date:   Thu, 17 Dec 2020 23:34:33 +0800
From:   Lai Jiangshan <jiangshanlai@...il.com>
To:     linux-kernel@...r.kernel.org
Cc:     Lai Jiangshan <laijs@...ux.alibaba.com>,
        Shuah Khan <shuah@...nel.org>, linux-kselftest@...r.kernel.org
Subject: [PATCH 2/2] selftest: parse the max cpu corretly from cpu list string

From: Lai Jiangshan <laijs@...ux.alibaba.com>

"," is allowed in cpu list strings, such as "0-3,5".  We need
to handle these cases.

Signed-off-by: Lai Jiangshan <laijs@...ux.alibaba.com>
---
 tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
index 5cdef96326a7..ac37bd54ea1c 100755
--- a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
+++ b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
@@ -30,7 +30,7 @@ prerequisite()
 
 	echo "CPU online/offline summary:"
 	online_cpus=`cat $SYSFS/devices/system/cpu/online`
-	online_max=${online_cpus##*-}
+	online_max=${online_cpus##*[-|,]}
 
 	if [[ "$online_cpus" = "$online_max" ]]; then
 		echo "$msg: since there is only one cpu: $online_cpus"
@@ -38,7 +38,7 @@ prerequisite()
 	fi
 
 	present_cpus=`cat $SYSFS/devices/system/cpu/present`
-	present_max=${present_cpus##*-}
+	present_max=${present_cpus##*[-|,]}
 	echo "present_cpus = $present_cpus present_max = $present_max"
 
 	echo -e "\t Cpus in online state: $online_cpus"
@@ -47,7 +47,7 @@ prerequisite()
 	if [[ "a$offline_cpus" = "a" ]]; then
 		offline_cpus=0
 	else
-		offline_max=${offline_cpus##*-}
+		offline_max=${offline_cpus##*[-|,]}
 	fi
 	echo -e "\t Cpus in offline state: $offline_cpus"
 }
-- 
2.19.1.6.gb485710b

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ