diff options
| author | John Hubbard <jhubbard@nvidia.com> | 2024-07-03 19:52:47 -0700 |
|---|---|---|
| committer | Shuah Khan <skhan@linuxfoundation.org> | 2024-07-05 13:21:48 -0600 |
| commit | f76f9bc616b7320df6789241ca7d26cedcf03cf3 (patch) | |
| tree | 013db5816d5ddba14908d6068fcc51362be2e77b /tools/testing/selftests/timens/vfork_exec.c | |
| parent | 48236960c06d32370bfa6f2cc408e786873262c8 (diff) | |
selftest/timerns: fix clang build failures for abs() calls
When building with clang, via:
make LLVM=1 -C tools/testing/selftests
...clang warns about mismatches between the expected and required
integer length being supplied to abs(3).
Fix this by using the correct variant of abs(3): labs(3) or llabs(3), in
these cases.
Reviewed-by: Dmitry Safonov <dima@arista.com>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Acked-by: Andrei Vagin <avagin@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/timens/vfork_exec.c')
| -rw-r--r-- | tools/testing/selftests/timens/vfork_exec.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/timens/vfork_exec.c b/tools/testing/selftests/timens/vfork_exec.c index beb7614941fb..5b8907bf451d 100644 --- a/tools/testing/selftests/timens/vfork_exec.c +++ b/tools/testing/selftests/timens/vfork_exec.c @@ -32,7 +32,7 @@ static void *tcheck(void *_args) for (i = 0; i < 2; i++) { _gettime(CLOCK_MONOTONIC, &tst, i); - if (abs(tst.tv_sec - now->tv_sec) > 5) { + if (labs(tst.tv_sec - now->tv_sec) > 5) { pr_fail("%s: in-thread: unexpected value: %ld (%ld)\n", args->tst_name, tst.tv_sec, now->tv_sec); return (void *)1UL; @@ -64,7 +64,7 @@ static int check(char *tst_name, struct timespec *now) for (i = 0; i < 2; i++) { _gettime(CLOCK_MONOTONIC, &tst, i); - if (abs(tst.tv_sec - now->tv_sec) > 5) + if (labs(tst.tv_sec - now->tv_sec) > 5) return pr_fail("%s: unexpected value: %ld (%ld)\n", tst_name, tst.tv_sec, now->tv_sec); } |
