Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1728375 > unrolled thread

[PATCH 2/2] selftests/memfd: Add null check for freepgs.

Started byThomas Meyer <thomas@m3y3r.de>
First post2017-09-07 20:50 +0200
Last post2017-09-07 20:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] selftests/memfd: Add null check for freepgs. Thomas Meyer <thomas@m3y3r.de> - 2017-09-07 20:50 +0200

#1728375 — [PATCH 2/2] selftests/memfd: Add null check for freepgs.

FromThomas Meyer <thomas@m3y3r.de>
Date2017-09-07 20:50 +0200
Subject[PATCH 2/2] selftests/memfd: Add null check for freepgs.
Message-ID<una2e-3SJ-31@gated-at.bofh.it>
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@m3y3r.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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web