selftest/kexec: fix "ignored null byte in input" warning

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

Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
Mimi Zohar 2021-11-24 12:38:00 +05:30
parent 92ad19559e
commit cef5cd25a4

View file

@ -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