]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:06:49 +0000 (14:06 +0200)
commit77dbaa6624b25731e77e9ec946188d258f3aa7f0
tree505a4a7271db3b01c27eaae4d6dc5a5e5aa4fc6d
parent929b5daafacc5085de4c5db1f3c4917f7bba86d3
rtc: check if __rtc_read_time was successful

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>
drivers/rtc/interface.c