Repository navigation
x86/init: Initialize wall clock in get_rtc_noop() - #163
Open
Naman Jain (namancse) wants to merge 1 commit into
Open
Naman Jain (namancse) wants to merge 1 commit into
Naman Jain (namancse) wants to merge 1 commit into
Conversation
get_rtc_noop() is used when an RTC is unavailable, but leaves its output argument untouched. When CONFIG_INIT_STACK_ALL_ZERO is not enabled, timekeeping_init() may therefore receive a nonzero invalid persistent clock value and warn: "Persistent clock returned invalid value" Initialize the output to zero, the documented representation of an unsupported persistent clock. Fixes: c311ed6 ("x86/init: Allow DT configured systems to disable RTC at boot time") Cc: stable@vger.kernel.org Reviewed-by: Thomas Gleixner <tglx@kernel.org> Reviewed-by: Roman Kisel <vdso@mailbox.org> Reviewed-by: Dexuan Cui <decui@microsoft.com> Reviewed-by: Hardik Garg <hargar@linux.microsoft.com> Signed-off-by: Naman Jain <namjain@linux.microsoft.com> Link: https://lore.kernel.org/all/20260831082528.1623843-1-namjain@linux.microsoft.com/ Reviewed, but not picked in mainline at the time of backporting. Signed-off-by: Naman Jain <namjain@linux.microsoft.com>
Naman Jain (namancse)
requested review from
Hardik Garg (hargar19)
and
a balanced review from Copilot
October 26, 2026 05:13
There was a problem hiding this comment.
🟢 Approval recommended
The localized change correctly initializes the output to zero and has no unresolved review findings.
No open issues 🎉
What changed in this PR
This PR fixes the x86 fallback used when no RTC is available by returning a zero persistent-clock value instead of leaving the output uninitialized.
Changes:
- Zero-initialize the
timespec64output inget_rtc_noop(). - Prevent invalid persistent-clock warnings caused by uninitialized stack data.
| File | Description |
|---|---|
arch/x86/kernel/x86_init.c |
Initialize the no-RTC clock output to the documented unsupported-clock value. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
get_rtc_noop() is used when an RTC is unavailable, but leaves its output argument untouched. When CONFIG_INIT_STACK_ALL_ZERO is not enabled, timekeeping_init() may therefore receive a nonzero invalid persistent clock value and warn:
"Persistent clock returned invalid value"
Initialize the output to zero, the documented representation of an unsupported persistent clock.
Fixes: c311ed6 ("x86/init: Allow DT configured systems to disable RTC at boot time")
Cc: stable@vger.kernel.org
Reviewed-by: Thomas Gleixner tglx@kernel.org
Reviewed-by: Roman Kisel vdso@mailbox.org
Reviewed-by: Dexuan Cui decui@microsoft.com
Reviewed-by: Hardik Garg hargar@linux.microsoft.com
Link: https://lore.kernel.org/all/20260831082528.1623843-1-namjain@linux.microsoft.com/
Reviewed, but not picked in mainline at the time of backporting.