]> git.itanic.dy.fi Git - linux-stable/commit
selftests: timers: Fix abs() warning in posix_timers test
authorJohn Stultz <jstultz@google.com>
Wed, 10 Apr 2024 23:26:30 +0000 (16:26 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Apr 2024 09:23:39 +0000 (11:23 +0200)
commitb5d274735809870e5e52ed643b726d435e79eefb
tree852d5c58f9cd6a8dd0908b4119297cdf7114bbf9
parent2ba19907b18d6bd7cb7466774cd799886521cd43
selftests: timers: Fix abs() warning in posix_timers test

commit ed366de8ec89d4f960d66c85fc37d9de22f7bf6d upstream.

Building with clang results in the following warning:

  posix_timers.c:69:6: warning: absolute value function 'abs' given an
      argument of type 'long long' but has parameter of type 'int' which may
      cause truncation of value [-Wabsolute-value]
        if (abs(diff - DELAY * USECS_PER_SEC) > USECS_PER_SEC / 2) {
            ^
So switch to using llabs() instead.

Fixes: 0bc4b0cf1570 ("selftests: add basic posix timers selftests")
Signed-off-by: John Stultz <jstultz@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240410232637.4135564-3-jstultz@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/testing/selftests/timers/posix_timers.c