[LTP] [PATCH 1/3] Fix lockdown and secureboot check in init_module tests

Martin Doucha
2023-09-22T07:42:36Z

testcases/kernel/syscalls/finit_module/finit_module02.c | 4 ++--
testcases/kernel/syscalls/init_module/init_module02.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/syscalls/finit_module/finit_module02.c b/testcases/kernel/syscalls/finit_module/finit_module02.c
index af4feb76b..223d9b388 100644
--- a/testcases/kernel/syscalls/finit_module/finit_module02.c
+++ b/testcases/kernel/syscalls/finit_module/finit_module02.c
@@ -83,8 +83,8 @@ static void setup(void)

tst_module_exists(MODULE_NAME, &mod_path);

- kernel_lockdown = tst_lockdown_enabled();
- secure_boot = tst_secureboot_enabled();
+ kernel_lockdown = tst_lockdown_enabled() > 0;
+ secure_boot = tst_secureboot_enabled() > 0;

SAFE_MKDIR(TEST_DIR, 0700);
fd_dir = SAFE_OPEN(TEST_DIR, O_DIRECTORY);
diff --git a/testcases/kernel/syscalls/init_module/init_module02.c b/testcases/kernel/syscalls/init_module/init_module02.c
index 15a482664..e6730e21c 100644
--- a/testcases/kernel/syscalls/init_module/init_module02.c
+++ b/testcases/kernel/syscalls/init_module/init_module02.c
@@ -53,8 +53,8 @@ static void setup(void)

tst_module_exists(MODULE_NAME, NULL);

- kernel_lockdown = tst_lockdown_enabled();
- secure_boot = tst_secureboot_enabled();
+ kernel_lockdown = tst_lockdown_enabled() > 0;
+ secure_boot = tst_secureboot_enabled() > 0;
fd = SAFE_OPEN(MODULE_NAME, O_RDONLY|O_CLOEXEC);
SAFE_FSTAT(fd, &sb);
size = sb.st_size;