[LTP] [PATCH COMMITTED] lib/tst_test.c: fix NULL ptr deref when "filesystems" is not defined

Jan Stancek jstancek@redhat.com
Sat Oct 12 18:04:32 CEST 2024


Fixes: 257394e4e356 ("Filter mkfs version in tst_fs")

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 lib/tst_test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/tst_test.c b/lib/tst_test.c
index 8d205a42f7c5..d942a91f17f3 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -1425,10 +1425,10 @@ static void do_setup(int argc, char *argv[])
 		tdev.fs_type = default_fs_type();
 
 		if (!tst_test->all_filesystems && count_fs_descs() <= 1) {
-			if (tst_test->filesystems->mkfs_ver)
+			if (tst_test->filesystems && tst_test->filesystems->mkfs_ver)
 				tst_check_cmd(tst_test->filesystems->mkfs_ver, 1);
 
-			if (tst_test->filesystems->min_kver)
+			if (tst_test->filesystems && tst_test->filesystems->min_kver)
 				check_kver(tst_test->filesystems->min_kver, 1);
 
 			prepare_device(tst_test->filesystems);
-- 
2.43.0



More information about the ltp mailing list