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]
Date:   Thu,  7 Sep 2017 20:36:10 +0200
From:   Thomas Meyer <thomas@...3r.de>
To:     shuah@...nel.org, linux-kernel@...r.kernel.org
Cc:     Thomas Meyer <thomas@...3r.de>
Subject: [PATCH 2/2] selftests/memfd: Add null check for freepgs.

User mode linux kernel has no huge pages. So this variable will be null.
Guard all tests in the shell script with a null check.

Signed-off-by: Thomas Meyer <thomas@...3r.de>
---
 tools/testing/selftests/memfd/run_tests.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/memfd/run_tests.sh b/tools/testing/selftests/memfd/run_tests.sh
index daabb350697c..0b65bacf8694 100755
--- a/tools/testing/selftests/memfd/run_tests.sh
+++ b/tools/testing/selftests/memfd/run_tests.sh
@@ -46,7 +46,7 @@ fi
 # If still not enough huge pages available, exit.  But, give back any huge
 # pages potentially allocated above.
 #
-if [ $freepgs -lt $hpages_test ]; then
+if [ -n "$freepgs" ] && [ $freepgs -lt $hpages_test ]; then
 	# nr_hugepgs non-zero only if we attempted to increase
 	if [ -n "$nr_hugepgs" ]; then
 		echo $nr_hugepgs > /proc/sys/vm/nr_hugepages
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ