summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLiu Dalin <liudalin@kylinsec.com.cn>2026-08-27 16:03:20 +0800
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2026-10-02 10:36:20 +0200
commit32f04694fa87b8ac9fa58f9ceb2dc6cbc476e2a1 (patch)
tree322db7beda0f254cb5189cd54cf19115a11cc738 /include
parentd41ee317c9907d714014d0d5e4726fbd6acf338e (diff)
downloadlinux-next-32f04694fa87b8ac9fa58f9ceb2dc6cbc476e2a1.tar.gz
linux-next-32f04694fa87b8ac9fa58f9ceb2dc6cbc476e2a1.zip
rtc: ftrtc010: fix integer overflow in time calculation
In ftrtc010_rtc_read_time() and ftrtc010_rtc_set_time(), all variables (offset, days, hour, min, sec) are u32. The expression "days * 86400 + hour * 3600 + min * 60 + sec" is evaluated in 32-bit arithmetic, which silently wraps around for dates beyond approximately year 2106 (U32_MAX / 86400 ≈ 49710 days). In ftrtc010_rtc_read_time(), perform the addition in 32-bit arithmetic first to preserve two's complement wrapping for negative offsets, then cast the result to timeu64_t. In ftrtc010_rtc_set_time(), cast individual u32 operands to timeu64_t before multiplication to prevent overflow in the right-hand side of the offset calculation. Fixes: 1d61d2592c1f ("rtc: gemini/ftrtc010: rename driver and symbols") Assisted-by: Sashiko AI [static analysis] Signed-off-by: Liu Dalin <liudalin@kylinsec.com.cn> Reviewed-by: Linus Walleij <linusw@kernel.org> Tested-by: Liu Dalin <liudalin@kylinsec.com.cn> Link: https://patch.msgid.link/42C8FBD59AA34EA9+20260827080320.3351155-4-liudalin@kylinsec.com.cn Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions