[LTP] [PATCH] lib: Fix bug in tst_test metadata validation

Petr Vorel pvorel@suse.cz
Fri Apr 11 13:59:39 CEST 2025


Hi Martin,

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

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> ---
>  lib/tst_test.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index 9a23cd4a0..694861d95 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -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);


More information about the ltp mailing list