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] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 9 Sep 2022 15:51:57 +0800
From:   Zhao Gongyi <zhaogongyi@...wei.com>
To:     <linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linux-mm@...ck.org>, <linux-kselftest@...r.kernel.org>
CC:     <akinobu.mita@...il.com>, <corbet@....net>, <david@...hat.com>,
        <osalvador@...e.de>, <shuah@...nel.org>,
        Zhao Gongyi <zhaogongyi@...wei.com>
Subject: [PATCH -next 2/5] selftests/memory-hotplug: Use 'printf' instead of 'echo'

Fault injection uses debugfs in a way that the provided values via
sysfs are interpreted as u64. Providing negative numbers results
in errors:

  # sh mem-on-off-test.sh
  ...
  mem-on-off-test.sh: line 267: echo: write error: Invalid argument
  ...
  mem-on-off-test.sh: line 283: echo: write error: Invalid argument
  ...
  #

Signed-off-by: Zhao Gongyi <zhaogongyi@...wei.com>
---
 tools/testing/selftests/memory-hotplug/mem-on-off-test.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
index 46a97f318f58..f1a9d81b934c 100755
--- a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
+++ b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
@@ -264,7 +264,8 @@ done
 #
 # Test memory hot-add error handling (offline => online)
 #
-echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_ONLINE/error
+printf %#x $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_ONLINE/erro
+
 for memory in `hotpluggable_offline_memory`; do
 	online_memory_expect_fail $memory
 done
@@ -280,7 +281,7 @@ done
 #
 # Test memory hot-remove error handling (online => offline)
 #
-echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_OFFLINE/error
+printf %#x $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_OFFLINE/error
 for memory in `hotpluggable_online_memory`; do
 	if [ $((RANDOM % 100)) -lt $ratio ]; then
 		offline_memory_expect_fail $memory
--
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ