FAILED: patch "[PATCH] rtc: check if __rtc_read_time was successful" failed to apply to 4.9-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 915593a7a663b2ad08b895a5f3ba8b19d89d4ebf Mon Sep 17 00:00:00 2001
From: Tom Rix <[email protected]>
Date: Sat, 26 Mar 2022 12:42:36 -0700
Subject: [PATCH] rtc: check if __rtc_read_time was successful
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.
drivers/rtc/interface.c +5 -2
@@ -804,9 +804,13 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer)struct timerqueue_node *next =timerqueue_getnext (&rtc->timerqueue);struct rtc_time tm;ktime_t now; +int err; + + err =__rtc_read_time (rtc, &tm); +if (err) +return err; timer->enabled =1 ; -__rtc_read_time (rtc, &tm); now =rtc_tm_to_ktime (tm);/* Skip over expired timers */
@@ -820,7 +824,6 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer)trace_rtc_timer_enqueue (timer);if (!next ||ktime_before (timer->node.expires, next->expires)) {struct rtc_wkalrm alarm; -int err; alarm.time =rtc_ktime_to_tm (timer->node.expires); alarm.enabled =1 ;