All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Subject: [LTP] [PATCH 1/1] tst_clocks: Fix unaddressable byte warning
Date: Thu, 27 Jul 2023 16:58:49 +0200	[thread overview]
Message-ID: <20230727145849.1893-1-pvorel@suse.cz> (raw)

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

             reply	other threads:[~2023-07-27 14:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27 14:58 Petr Vorel [this message]
2023-07-27 15:24 ` [LTP] [PATCH 1/1] tst_clocks: Fix unaddressable byte warning Cyril Hrubis
2023-07-28 18:39   ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230727145849.1893-1-pvorel@suse.cz \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.