[LTP] [PATCH] cpuset_memory_testset.sh: Fix syntax error when hugepages not supported

Martin Doucha mdoucha@suse.cz
Wed Jul 19 10:55:27 CEST 2023


The initial hugepage size calculation can result in multiplication
of empty string on machines which don't support hugepages. Make
sure that empty string is converted to zero.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 .../cpuset/cpuset_memory_test/cpuset_memory_testset.sh          | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh b/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh
index cb7dbd867..c1e7cea8f 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh
@@ -41,7 +41,7 @@ mems_all="$(seq -s, 0 $((nr_mems-1)))"
 cpu_of_node0=0
 
 HUGEPAGESIZE=$(awk '/Hugepagesize/{ print $2 }' /proc/meminfo)
-HUGEPAGESIZE=$(($HUGEPAGESIZE * 1024))
+HUGEPAGESIZE=$((${HUGEPAGESIZE:-0} * 1024))
 
 MEMORY_RESULT="$CPUSET_TMP/memory_result"
 
-- 
2.41.0



More information about the ltp mailing list