[LTP] [COMMITTED] utimensat01: fix kvers arrary boundary

Li Wang liwang@redhat.com
Mon Aug 31 08:35:52 CEST 2020


To get rid of errors:
   8 utimensat01.c:295: INFO: Testing variant: syscall with old kernel spec
   9 tst_test.c:1300: BROK: Test killed by SIGSEGV!

and,
  BROK: utimensat01.c:293: mkdir(test_dir,0700) failed: EEXIST (17)

Signed-off-by: Li Wang <liwang@redhat.com>
---
 testcases/kernel/syscalls/utimensat/utimensat01.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/utimensat/utimensat01.c b/testcases/kernel/syscalls/utimensat/utimensat01.c
index 5cc5f1d33..e2d4fee3e 100644
--- a/testcases/kernel/syscalls/utimensat/utimensat01.c
+++ b/testcases/kernel/syscalls/utimensat/utimensat01.c
@@ -161,6 +161,7 @@ static void update_error(struct test_case *tc)
 	static struct tst_kern_exv kvers[] = {
 		/* Ubuntu kernel has patch b3b4283 since 4.4.0-48.69 */
 		{ "UBUNTU", "4.4.0-48.69" },
+		{ NULL, NULL},
 	};
 
 	if (tc->exp_err != -1)
@@ -295,7 +296,8 @@ static void setup(void)
 	tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
 
 	bad_addr = tst_get_bad_addr(NULL);
-	SAFE_MKDIR(TEST_DIR, 0700);
+	if (access(TEST_DIR, R_OK))
+		SAFE_MKDIR(TEST_DIR, 0700);
 
 	for (i = 0; i < ARRAY_SIZE(tcase); i++)
 		update_error(&tcase[i]);
-- 
2.21.1



More information about the ltp mailing list