Re: [PATCH] rtc: ftrtc010: fix negative offset handling and smatch warning

From: Linus Walleij

Date: Thu Oct 08 2026 - 09:07:42 EST


On Thu, Oct 8, 2026 at 1:59 PM Alexandre Belloni
<alexandre.belloni@xxxxxxxxxxx> wrote:
> On 08/10/2026 19:37:32+0800, Liu Dalin wrote:

> > A prior attempted to fix the 32-bit arithmetic overflow by turning
> > the implicit u32-to-timeu64_t cast into an explicit one. However,
> > all calculations still happen in u32, inheriting the existing
> > negative offset sign-extension bug, and the explicit cast triggers
> > smatch "cast after binop" warning.
> >
>
> AI is lying to you, offset will never ever be negative.

This looks like something that warrants a clause in:
https://github.com/masoncl/review-prompts/tree/main/kernel/subsystem
in a new rtc.md

I added a file for gpio after some insane review ideas
from Sashiko, hopefully it takes effect.

Yours,
Linus Walleij