[PATCH] selftests: timers: raw_skew: initialize mon

From: Sasha Levin

Date: Tue Nov 03 2026 - 18:23:32 EST


gcc 16 doesn't see that get_monotonic_and_raw() always sets *mon, as
the first iteration of its loop takes the diff == 0 branch, and warns
once the function is inlined into main():

raw_skew.c:46:26: warning: '*(__time_t *)((char *)&mon + offsetof(struct timespec, tv_sec))' may be used uninitialized [-Wmaybe-uninitialized]

Initialize mon to quiet it.

Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
Found with gcc 16.2; gcc 14 and 15 and clang 21 don't warn.

tools/testing/selftests/timers/raw_skew.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/selftests/timers/raw_skew.c
index dfca3e2d50d2e..ec9e5b2691c94 100644
--- a/tools/testing/selftests/timers/raw_skew.c
+++ b/tools/testing/selftests/timers/raw_skew.c
@@ -89,7 +89,7 @@ void get_monotonic_and_raw(struct timespec *mon, struct timespec *raw)

int main(int argc, char **argv)
{
- struct timespec mon, raw, start, end;
+ struct timespec mon = {}, raw, start, end;
long long delta1, delta2, interval, eppm, ppm;
long tick_nom;
struct timex tx1, tx2;
--
2.53.0