selftests: timerfd.c:64:7: error: absolute value function 'abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value

From: Naresh Kamboju
Date: Thu Aug 17 2023 - 07:01:32 EST


While building selftests landlock following warnings / errors noticed on the
Linux next with clang-17 toolchain.

Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>

Build errors:
------------
timens/timerfd
timerfd.c:64:7: error: absolute value function 'abs' given an argument
of type 'long long' but has parameter of type 'int' which may cause
truncation of value [-Werror,-Wabsolute-value]
64 | if (abs(elapsed - 3600) > 60) {
| ^
timerfd.c:64:7: note: use function 'llabs' instead
64 | if (abs(elapsed - 3600) > 60) {
| ^~~
| llabs
1 error generated.
make[4]: Leaving directory 'selftests/timens'


Links:
- https://storage.tuxsuite.com/public/linaro/lkft/builds/2U69ue7AaypfY7eRU4UUygecrDx/

Steps to reproduce:
tuxmake --runtime podman --target-arch arm64 --toolchain clang-17
--kconfig https://storage.tuxsuite.com/public/linaro/lkft/builds/2U69ue7AaypfY7eRU4UUygecrDx/config
LLVM=1 LLVM_IAS=1 dtbs dtbs-legacy headers kernel kselftest modules

--
Linaro LKFT
https://lkft.linaro.org