Skip to contentSkip to conversation

lib: Fix bug in tst_test metadata validation

PATCH In review Martin Doucha 3 participants 5 messages Apr 8, 2025 – Apr 11, 2025 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib: Fix bug in tst_test metadata validation

The results pointer is NULL when do_setup() checks tst_test metadata validity. Print the invalid runtime value from the correct pointer.

---
 lib/tst_test.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
lib/tst_test.c +2 -4
index 9a23cd4a0..694861d95 100644
@@ -1267,10 +1267,8 @@ static void do_setup(int argc, char *argv[])
 			tst_test->timeout);
 	}
 
-	if (tst_test->runtime < 0) {
-		tst_brk(TBROK, "Invalid runtime value %i",
-			results->runtime);
-	}
+	if (tst_test->runtime < 0)
+		tst_brk(TBROK, "Invalid runtime value %i", tst_test->runtime);
 
 	if (tst_test->tconf_msg)
 		tst_brk(TCONF, "%s", tst_test->tconf_msg);
Signature · 5 lines
2.49.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/1
#1 lore raw

Hi Martin,

Quoted 2 lines

The results pointer is NULL when do_setup() checks tst_test metadata validity. Print the invalid runtime value from the correct pointer.

Ah, core dump. Good catch, thanks!

Kind regards,
Petr

Quoted 22 lines
---
 lib/tst_test.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
lib/tst_test.c +2 -4
index 9a23cd4a0..694861d95 100644
@@ -1267,10 +1267,8 @@ static void do_setup(int argc, char *argv[])
 			tst_test->timeout);
 	}
 
-	if (tst_test->runtime < 0) {
-		tst_brk(TBROK, "Invalid runtime value %i",
-			results->runtime);
-	}
+	if (tst_test->runtime < 0)
+		tst_brk(TBROK, "Invalid runtime value %i", tst_test->runtime);
 
 	if (tst_test->tconf_msg)
 		tst_brk(TCONF, "%s", tst_test->tconf_msg);
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
In reply to Martin Doucha

Also:

Fixes a6a369c5ee ("lib: redefine the overall timeout logic of test")

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw

Hi all,

fix merged, thanks!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp