[LTP] [PATCH 1/1] tst_clocks: Fix unaddressable byte warning
Petr Vorel
pvorel@suse.cz
Thu Jul 27 16:58:49 CEST 2023
Valgrind complains about unaddressable byte:
tst_test.c:1559: TINFO: Timeout per run is 0h 00m 30s
==28379== Syscall param clock_gettime(tp) points to unaddressable byte(s)
==28379== at 0x497D41D: syscall (in /usr/lib64/libc.so.6)
==28379== by 0x412CCF: syscall_supported_by_kernel (tst_clocks.c:21)
==28379== by 0x412CCF: tst_clock_gettime (tst_clocks.c:71)
==28379== by 0x405A72: heartbeat (tst_test.c:1359)
==28379== by 0x4063CB: testrun (tst_test.c:1443)
==28379== by 0x4063CB: fork_testrun (tst_test.c:1593)
==28379== by 0x40840B: tst_run_tcases (tst_test.c:1687)
==28379== by 0x404CDD: main (tst_test.h:398)
==28379== Address 0x0 is not stack'd, malloc'd or (recently) free'd
While this is not a real problem, because it is in the library, this
warning appears in every test, which can be confusing.
Fixes: 4ac3a9c92 ("syscalls: Don't pass struct timespec to tst_syscall()")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
lib/tst_clocks.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/tst_clocks.c b/lib/tst_clocks.c
index 0417802fc..2144a6ae5 100644
--- a/lib/tst_clocks.c
+++ b/lib/tst_clocks.c
@@ -17,8 +17,9 @@ typedef int (*mysyscall)(clockid_t clk_id, void *ts);
int syscall_supported_by_kernel(long sysnr)
{
int ret;
+ struct timespec foo;
- ret = syscall(sysnr, 0, NULL);
+ ret = syscall(sysnr, 0, &foo);
if (ret == -1 && errno == ENOSYS)
return 0;
--
2.41.0
More information about the ltp
mailing list