[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240304181140.644212-4-edliaw@google.com>
Date: Mon, 4 Mar 2024 18:11:34 +0000
From: Edward Liaw <edliaw@...gle.com>
To: linux-kernel@...r.kernel.org, John Stultz <jstultz@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>, Stephen Boyd <sboyd@...nel.org>, Shuah Khan <shuah@...nel.org>,
Nathan Chancellor <nathan@...nel.org>, Nick Desaulniers <ndesaulniers@...gle.com>,
Bill Wendling <morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>
Cc: linux-kselftest@...r.kernel.org, kernel-team@...roid.com,
Edward Liaw <edliaw@...gle.com>, llvm@...ts.linux.dev
Subject: [PATCH v1 3/3] selftests/timers/posix_timers: Use llabs for long long
Fixes clang warning: absolute value function 'abs' given an argument of
type 'long long' but has parameter of type 'int' which may cause
truncation of value.
Signed-off-by: Edward Liaw <edliaw@...gle.com>
---
tools/testing/selftests/timers/posix_timers.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/timers/posix_timers.c b/tools/testing/selftests/timers/posix_timers.c
index 0f550fc9e879..78b4b2d3dc44 100644
--- a/tools/testing/selftests/timers/posix_timers.c
+++ b/tools/testing/selftests/timers/posix_timers.c
@@ -82,7 +82,7 @@ static int check_diff(struct timeval start, struct timeval end)
diff = end.tv_usec - start.tv_usec;
diff += (end.tv_sec - start.tv_sec) * USECS_PER_SEC;
- if (abs(diff - DELAY * USECS_PER_SEC) > USECS_PER_SEC / 2)
+ if (llabs(diff - DELAY * USECS_PER_SEC) > USECS_PER_SEC / 2)
return -1;
return 0;
--
2.44.0.rc1.240.g4c46232300-goog
Powered by blists - more mailing lists