]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
rtc: check if __rtc_read_time was successful
authorTom Rix <trix@redhat.com>
Sat, 26 Mar 2022 19:42:36 +0000 (12:42 -0700)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 20 May 2022 12:40:13 +0000 (14:40 +0200)
commit398bd1c1d9530de42c6f0548591daad4a7f02a79
treed65019a081728256a6edd276abeadb1fe06f8650
parentbf6c0bb5db758072e446ae167c5fda5a5c493775
rtc: check if __rtc_read_time was successful

BugLink: https://bugs.launchpad.net/bugs/1969110
commit 915593a7a663b2ad08b895a5f3ba8b19d89d4ebf upstream.

Clang static analysis reports this issue
interface.c:810:8: warning: Passed-by-value struct
  argument contains uninitialized data
  now = rtc_tm_to_ktime(tm);
      ^~~~~~~~~~~~~~~~~~~

tm is set by a successful call to __rtc_read_time()
but its return status is not checked.  Check if
it was successful before setting the enabled flag.
Move the decl of err to function scope.

Fixes: 2b2f5ff00f63 ("rtc: interface: ignore expired timers when enqueuing new timers")
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220326194236.2916310-1-trix@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 50ed32e67c5c9cd87169db605f9d207b24429cb3)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/rtc/interface.c