diff mbox series

[ndctl,v2,2/3] cxl/test: add double quotes in cxl-xor-region.sh

Message ID 0738a7a0148a24a40e1ff863a51dfc2806e2fdfd.1708650921.git.alison.schofield@intel.com (mailing list archive)
State Accepted
Commit 6fa74aae8f511eca532ea1fb35910d00fe230533
Headers show
Series Tidy-up, then expand, cxl-xor-region.sh | expand

Commit Message

Alison Schofield Feb. 23, 2024, 1:40 a.m. UTC
From: Alison Schofield <alison.schofield@intel.com>

Add double quotes to prevent globbing and word splitting.
Found using shellcheck.

Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---
 test/cxl-xor-region.sh | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/test/cxl-xor-region.sh b/test/cxl-xor-region.sh
index 5ab7ede11e56..e536f0256202 100644
--- a/test/cxl-xor-region.sh
+++ b/test/cxl-xor-region.sh
@@ -23,7 +23,8 @@  rc=1
 
 create_and_destroy_region()
 {
-	region=$($CXL create-region -d $decoder -m $memdevs | jq -r ".region")
+	region=$($CXL create-region -d "$decoder" -m "$memdevs" |
+		jq -r ".region")
 
 	if [[ ! $region ]]; then
 		echo "create-region failed for $decoder"
@@ -42,9 +43,9 @@  setup_x1()
 		.decoder")
 
 	# Find a memdev for this host-bridge
-	port_dev0=$($CXL list -T -d $decoder | jq -r ".[] |
+	port_dev0=$($CXL list -T -d "$decoder" | jq -r ".[] |
 		.targets | .[] | select(.position == 0) | .target")
-	mem0=$($CXL list -M -p $port_dev0 | jq -r ".[0].memdev")
+	mem0=$($CXL list -M -p "$port_dev0" | jq -r ".[0].memdev")
 	memdevs="$mem0"
 }
 
@@ -57,12 +58,12 @@  setup_x2()
 		.decoder")
 
 	# Find a memdev for each host-bridge interleave position
-	port_dev0=$($CXL list -T -d $decoder | jq -r ".[] |
+	port_dev0=$($CXL list -T -d "$decoder" | jq -r ".[] |
 		.targets | .[] | select(.position == 0) | .target")
-	port_dev1=$($CXL list -T -d $decoder | jq -r ".[] |
+	port_dev1=$($CXL list -T -d "$decoder" | jq -r ".[] |
 		.targets | .[] | select(.position == 1) | .target")
-	mem0=$($CXL list -M -p $port_dev0 | jq -r ".[0].memdev")
-	mem1=$($CXL list -M -p $port_dev1 | jq -r ".[0].memdev")
+	mem0=$($CXL list -M -p "$port_dev0" | jq -r ".[0].memdev")
+	mem1=$($CXL list -M -p "$port_dev1" | jq -r ".[0].memdev")
 	memdevs="$mem0 $mem1"
 }
 
@@ -75,14 +76,14 @@  setup_x4()
 		.decoder")
 
 	# Find a memdev for each host-bridge interleave position
-	port_dev0=$($CXL list -T -d $decoder | jq -r ".[] |
+	port_dev0=$($CXL list -T -d "$decoder" | jq -r ".[] |
 		.targets | .[] | select(.position == 0) | .target")
-	port_dev1=$($CXL list -T -d $decoder | jq -r ".[] |
+	port_dev1=$($CXL list -T -d "$decoder" | jq -r ".[] |
 		.targets | .[] | select(.position == 1) | .target")
-	mem0=$($CXL list -M -p $port_dev0 | jq -r ".[0].memdev")
-	mem1=$($CXL list -M -p $port_dev1 | jq -r ".[0].memdev")
-	mem2=$($CXL list -M -p $port_dev0 | jq -r ".[1].memdev")
-	mem3=$($CXL list -M -p $port_dev1 | jq -r ".[1].memdev")
+	mem0=$($CXL list -M -p "$port_dev0" | jq -r ".[0].memdev")
+	mem1=$($CXL list -M -p "$port_dev1" | jq -r ".[0].memdev")
+	mem2=$($CXL list -M -p "$port_dev0" | jq -r ".[1].memdev")
+	mem3=$($CXL list -M -p "$port_dev1" | jq -r ".[1].memdev")
 	memdevs="$mem0 $mem1 $mem2 $mem3"
 }