public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] tst_clocks: Fix unaddressable byte warning
@ 2023-07-27 14:58 Petr Vorel
  2023-07-27 15:24 ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2023-07-27 14:58 UTC (permalink / raw)
  To: ltp; +Cc: Viresh Kumar

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


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-28 18:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-27 14:58 [LTP] [PATCH 1/1] tst_clocks: Fix unaddressable byte warning Petr Vorel
2023-07-27 15:24 ` Cyril Hrubis
2023-07-28 18:39   ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox