From: Sasha Levin <sashal@kernel.org>
To: John Stultz <jstultz@google.com>,
Thomas Gleixner <tglx@kernel.org>,
Anna-Maria Behnsen <anna-maria@linutronix.de>,
Frederic Weisbecker <frederic@kernel.org>
Cc: Stephen Boyd <sboyd@kernel.org>,
Miroslav Lichvar <mlichvar@redhat.com>,
Shuah Khan <shuah@kernel.org>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: [PATCH] selftests: timers: raw_skew: initialize mon
Date: Tue, 3 Nov 2026 18:23:06 -0500 [thread overview]
Message-ID: <20261103232307.1924618-2-sashal@kernel.org> (raw)
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@kernel.org>
---
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
reply other threads:[~2026-11-03 23:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261103232307.1924618-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=anna-maria@linutronix.de \
--cc=frederic@kernel.org \
--cc=jstultz@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mlichvar@redhat.com \
--cc=sboyd@kernel.org \
--cc=shuah@kernel.org \
--cc=tglx@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®