Re: [PATCH v2] rtc: cmos: zero-init wkalrm when reading from CMOS
From: Alexandre Belloni
Date: Thu Aug 20 2020 - 18:10:54 EST
On Fri, 14 Aug 2020 19:17:30 +1000, Victor Ding wrote:
> cmos_read_alarm() may leave certain fields of a struct rtc_wkalrm
> untouched; therefore, these fields contain garbage if not properly
> initialized, leading to inconsistent values when converting into
> time64_t. This patch to zero initialize the struct before calling
> cmos_read_alarm().
>
> Note that this patch is not intended to produce a correct time64_t, it
> is only to produce a consistent value. In the case of suspend/resume, a
> correct time64_t is not necessary; a consistent value is sufficient to
> correctly perform an equality test for t_current_expires and
> t_saved_expires. Logic to deduce a correct time64_t is expensive and
> hence should be avoided.
Applied, thanks!
[1/1] rtc: cmos: zero-init wkalrm when reading from CMOS
commit: c254bcd7231a3eeafc453f6ee3a483a2e7ff486e
Best regards,
--
Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>