[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAFr9PXna7YsYnfdtu1jvJhkVSX0SiyixYr_bTsx3tDepeHqcMg@mail.gmail.com>
Date: Wed, 29 Sep 2021 21:56:36 +0900
From: Daniel Palmer <daniel@...f.com>
To: Romain Perier <romain.perier@...il.com>
Cc: Colin King <colin.king@...onical.com>,
Daniel Palmer <daniel@...ngy.jp>,
Alessandro Zummo <a.zummo@...ertech.it>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Nobuhiro Iwamatsu <iwamatsu@...auri.org>,
linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
linux-rtc@...r.kernel.org, kernel-janitors@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH][next] rtc: msc313: Fix unintentional sign extension issue
on left shift of a u16
Hi Romain,
On Tue, 28 Sept 2021 at 22:55, Romain Perier <romain.perier@...il.com> wrote:
>
> Hi,
>
> Le mar. 28 sept. 2021 à 15:31, Daniel Palmer <daniel@...f.com> a écrit :
> The crazy stuff being, I ran rtctest from selftests and rtc-range (1)
> that tests a variety
> of dates including 2038 and 2106 for example. Both tests passed :) (probably
> because *this case* specifically did not happen while running the test)
I suspect it works because for reading the time because seconds is a
u32 not unsigned long like the other functions.
So if the high word of the register is read, is promoted to a wider
type and sign extended it doesn't actually matter because it gets
truncated to 32 bits so the sign extended part is gone.
Cheers,
Daniel
Powered by blists - more mailing lists