Re: [patch 1/8] rtc: mc146818: Prevent reading garbage - bug

From: Thomas Gleixner
Date: Tue Jan 26 2021 - 10:41:31 EST


On Tue, Jan 26 2021 at 15:17, Mickaël Salaün wrote:
> Thanks for the fix! It boots now with a new message:
> rtc_cmos rtc_cmos: not accessible
>> spin_lock_irqsave(&rtc_lock, flags);
>> + /* Ensure that the RTC is accessible. Bit 0-6 must be 0! */
>> + if (WARN_ON_ONCE((CMOS_READ(RTC_VALID) & 0x7f) != 0)) {
>> + spin_unlock_irqrestore(&rtc_lock, flags);
>> + memset(time, 0xff, sizeof(time));
>
> This should be: sizeof(*time)

Of course ....

>> + return 0;
>> + }
>> +
>> /*
>> * Check whether there is an update in progress during which the
>> * readout is unspecified. The maximum update time is ~2ms. Poll
>>
>
> Tested-by: Mickaël Salaün <mic@xxxxxxxxxxxxxxxxxxx>