]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/5.10.99/rtc-cmos-evaluate-century-appropriate.patch
Drop nfc patches from older trees
[thirdparty/kernel/stable-queue.git] / releases / 5.10.99 / rtc-cmos-evaluate-century-appropriate.patch
CommitLineData
73ce6861
GKH
1From ff164ae39b82ee483b24579c8e22a13a8ce5bd04 Mon Sep 17 00:00:00 2001
2From: Riwen Lu <luriwen@kylinos.cn>
3Date: Thu, 6 Jan 2022 16:46:09 +0800
4Subject: rtc: cmos: Evaluate century appropriate
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9From: Riwen Lu <luriwen@kylinos.cn>
10
11commit ff164ae39b82ee483b24579c8e22a13a8ce5bd04 upstream.
12
13There's limiting the year to 2069. When setting the rtc year to 2070,
14reading it returns 1970. Evaluate century starting from 19 to count the
15correct year.
16
17$ sudo date -s 20700106
18Mon 06 Jan 2070 12:00:00 AM CST
19$ sudo hwclock -w
20$ sudo hwclock -r
211970-01-06 12:00:49.604968+08:00
22
23Fixes: 2a4daadd4d3e5071 ("rtc: cmos: ignore bogus century byte")
24
25Signed-off-by: Riwen Lu <luriwen@kylinos.cn>
26Acked-by: Eric Wong <e@80x24.org>
27Reviewed-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
28Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
29Link: https://lore.kernel.org/r/20220106084609.1223688-1-luriwen@kylinos.cn
30Signed-off-by: Mateusz Jończyk <mat.jonczyk@o2.pl> # preparation for stable
31Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
32---
33 drivers/rtc/rtc-mc146818-lib.c | 2 +-
34 1 file changed, 1 insertion(+), 1 deletion(-)
35
36--- a/drivers/rtc/rtc-mc146818-lib.c
37+++ b/drivers/rtc/rtc-mc146818-lib.c
38@@ -83,7 +83,7 @@ unsigned int mc146818_get_time(struct rt
39 time->tm_year += real_year - 72;
40 #endif
41
42- if (century > 20)
43+ if (century > 19)
44 time->tm_year += (century - 19) * 100;
45
46 /*