Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Nageswara R Sastry <rnsastry@linux.ibm.com>
To: zohar@linux.ibm.com, linux-kselftest@vger.kernel.org,
	linux-integrity@vger.kernel.org, mpe@ellerman.id.au,
	shuah@kernel.org
Cc: nayna@linux.ibm.com, dja@axtens.net, gcwilson@linux.ibm.com
Subject: [PATCH 1/3] selftest/kexec: fix "ignored null byte in input" warning
Date: Wed, 24 Nov 2021 12:38:00 +0530	[thread overview]
Message-ID: <20211124070802.1765-1-rnsastry@linux.ibm.com> (raw)

From: Mimi Zohar <zohar@linux.ibm.com>

Instead of assigning the string to a variable, which might contain a
null character, redirect the output and grep for the string directly.

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
---
 tools/testing/selftests/kexec/test_kexec_file_load.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/kexec/test_kexec_file_load.sh b/tools/testing/selftests/kexec/test_kexec_file_load.sh
index 2ff600388c30..99f6fc23ee31 100755
--- a/tools/testing/selftests/kexec/test_kexec_file_load.sh
+++ b/tools/testing/selftests/kexec/test_kexec_file_load.sh
@@ -97,10 +97,11 @@ check_for_imasig()
 check_for_modsig()
 {
 	local module_sig_string="~Module signature appended~"
-	local sig="$(tail --bytes $((${#module_sig_string} + 1)) $KERNEL_IMAGE)"
 	local ret=0
 
-	if [ "$sig" == "$module_sig_string" ]; then
+	tail --bytes $((${#module_sig_string} + 1)) $KERNEL_IMAGE | \
+		grep -q "$module_sig_string"
+	if [ $? -eq 0 ]; then
 		ret=1
 		log_info "kexec kernel image modsig signed"
 	else
-- 
2.23.0


             reply	other threads:[~2021-11-24  7:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24  7:08 Nageswara R Sastry [this message]
2021-11-24  7:08 ` [PATCH 2/3] selftests/kexec: Enable secureboot tests for PowerPC Nageswara R Sastry
2021-12-13 23:23   ` Mimi Zohar
2022-01-05 16:09   ` Nayna
2021-11-24  7:08 ` [PATCH 3/3] Add tests to verify kexec of blacklist and non blacklist kernel Nageswara R Sastry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211124070802.1765-1-rnsastry@linux.ibm.com \
    --to=rnsastry@linux.ibm.com \
    --cc=dja@axtens.net \
    --cc=gcwilson@linux.ibm.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=nayna@linux.ibm.com \
    --cc=shuah@kernel.org \
    --cc=zohar@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox