If the system call failed the output memory is not usable.
Signed-off-by: Thomas Weißschuh thomas.weissschuh@linutronix.de --- tools/testing/selftests/vDSO/vdso_test_abi.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/vDSO/vdso_test_abi.c b/tools/testing/selftests/vDSO/vdso_test_abi.c index 7826d9c10ccaf313dc003e8959d9eb84b2cda874..ff142b3b9075b18e60a46b77492d285e9937fa71 100644 --- a/tools/testing/selftests/vDSO/vdso_test_abi.c +++ b/tools/testing/selftests/vDSO/vdso_test_abi.c @@ -168,12 +168,15 @@ static void vdso_test_clock_getres(__kernel_clockid_t clk_id) }
ret = syscall(SYS_clock_getres, clk_id, &sys_ts); + if (ret == 0) { + ksft_print_msg("The syscall resolution is %lld %lld\n", + (long long)sys_ts.tv_sec, (long long)sys_ts.tv_nsec);
- ksft_print_msg("The syscall resolution is %lld %lld\n", - (long long)sys_ts.tv_sec, (long long)sys_ts.tv_nsec); - - if ((sys_ts.tv_sec != ts.tv_sec) || (sys_ts.tv_nsec != ts.tv_nsec)) + if ((sys_ts.tv_sec != ts.tv_sec) || (sys_ts.tv_nsec != ts.tv_nsec)) + clock_getres_fail++; + } else { clock_getres_fail++; + }
if (clock_getres_fail > 0) { ksft_test_result_fail("%s %s\n", name[3],