Daniel Axtens
00b912b0c8
powerpc: Remove broken GregorianDay()
...
GregorianDay() is supposed to calculate the day of the week
(tm->tm_wday) for a given day/month/year. In that calcuation it
indexed into an array called MonthOffset using tm->tm_mon-1. However
tm_mon is zero-based, not one-based, so this is off-by-one. It also
means that every January, GregoiranDay() will access element -1 of
the MonthOffset array.
It also doesn't appear to be a correct algorithm either: see in
contrast kernel/time/timeconv.c's time_to_tm function.
It's been broken forever, which suggests no-one in userland uses
this. It looks like no-one in the kernel uses tm->tm_wday either
(see e.g. drivers/rtc/rtc-ds1305.c:319).
tm->tm_wday is conventionally set to -1 when not available in
hardware so we can simply set it to -1 and drop the function.
(There are over a dozen other drivers in drivers/rtc that do
this.)
Found using UBSAN.
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com >
Cc: Andrew Morton <akpm@linux-foundation.org > # as an example of what UBSan finds.
Cc: Alessandro Zummo <a.zummo@towertech.it >
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com >
Cc: rtc-linux@googlegroups.com
Signed-off-by: Daniel Axtens <dja@axtens.net >
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com >
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au >
2015-12-16 12:54:04 +11:00
..
2015-09-05 13:19:07 +02:00
2015-04-17 09:04:02 -04:00
2015-09-05 13:19:09 +02:00
2015-11-08 14:12:32 +01:00
2015-11-08 14:12:32 +01:00
2015-09-05 13:19:05 +02:00
2014-10-20 16:21:31 +02:00
2015-04-03 08:18:25 +02:00
2015-11-08 14:12:25 +01:00
2015-09-05 13:19:08 +02:00
2015-09-05 19:37:31 +02:00
2015-09-05 19:37:22 +02:00
2015-09-05 19:37:18 +02:00
2015-06-25 01:12:50 +02:00
2015-11-08 14:12:28 +01:00
2015-09-05 13:19:13 +02:00
2014-10-20 16:21:31 +02:00
2015-09-05 13:19:09 +02:00
2015-09-05 13:19:06 +02:00
2014-10-20 16:21:31 +02:00
2015-09-05 13:19:09 +02:00
2015-09-05 19:37:22 +02:00
2015-09-05 13:19:07 +02:00
2015-04-17 09:04:00 -04:00
2014-10-20 16:21:31 +02:00
2015-11-08 14:12:26 +01:00
2015-11-08 14:12:29 +01:00
2015-09-05 13:19:07 +02:00
2015-04-17 09:04:01 -04:00
2014-10-20 16:21:31 +02:00
2015-06-25 01:13:40 +02:00
2015-06-25 01:13:40 +02:00
2014-10-20 16:21:31 +02:00
2015-10-28 10:30:17 +09:00
2015-11-08 14:12:31 +01:00
2015-11-10 10:01:21 -08:00
2015-10-28 10:30:17 +09:00
2015-09-05 19:37:22 +02:00
2015-11-10 10:01:21 -08:00
2015-09-05 13:19:10 +02:00
2015-09-05 13:19:10 +02:00
2015-06-25 01:13:36 +02:00
2015-09-05 13:19:05 +02:00
2015-09-05 13:19:10 +02:00
2014-10-20 16:21:31 +02:00
2015-09-05 19:36:21 +02:00
2015-10-28 10:30:17 +09:00
2015-04-17 09:04:02 -04:00
2015-06-25 01:13:44 +02:00
2015-04-17 09:03:59 -04:00
2015-06-25 01:13:38 +02:00
2015-09-05 13:19:06 +02:00
2015-09-05 13:19:09 +02:00
2014-10-20 16:21:31 +02:00
2015-06-19 20:03:20 +02:00
2015-09-05 13:19:06 +02:00
2015-06-19 20:03:21 +02:00
2015-11-08 14:12:30 +01:00
2015-09-05 13:19:08 +02:00
2015-11-08 14:12:30 +01:00
2014-10-20 16:21:31 +02:00
2014-11-21 12:00:00 -08:00
2014-10-20 16:21:31 +02:00
2015-09-05 13:19:06 +02:00
2014-10-20 16:21:31 +02:00
2015-06-21 21:53:59 +02:00
2015-04-17 09:04:02 -04:00
2015-10-28 10:30:17 +09:00
2015-10-28 10:30:17 +09:00
2014-10-20 16:21:31 +02:00
2015-09-05 13:19:10 +02:00
2014-10-20 16:21:31 +02:00
2015-06-25 01:13:36 +02:00
2015-10-28 10:30:17 +09:00
2014-10-20 16:21:31 +02:00
2014-10-20 16:21:31 +02:00
2015-09-05 19:37:21 +02:00
2015-06-25 01:13:36 +02:00
2015-06-25 01:13:37 +02:00
2015-06-25 01:13:37 +02:00
2015-06-25 01:13:35 +02:00
2015-10-28 10:30:17 +09:00
2015-09-05 19:37:22 +02:00
2015-09-05 19:37:22 +02:00
2015-04-15 16:35:24 -07:00
2015-04-17 09:04:02 -04:00
2015-09-05 19:37:22 +02:00
2015-09-05 19:37:22 +02:00
2015-08-05 20:03:56 +08:00
2014-10-20 16:21:31 +02:00
2015-09-05 19:37:21 +02:00
2015-12-16 12:54:04 +11:00
2015-06-25 01:13:40 +02:00
2014-10-20 16:21:31 +02:00
2015-10-28 10:30:17 +09:00
2015-11-08 14:12:28 +01:00
2015-09-05 13:19:06 +02:00
2015-11-08 14:12:29 +01:00
2015-09-05 13:19:06 +02:00
2015-11-08 14:12:26 +01:00
2013-11-13 12:09:31 +09:00
2015-11-08 14:12:24 +01:00
2014-11-03 19:53:56 -08:00
2014-10-20 16:21:31 +02:00
2014-10-20 16:21:31 +02:00
2015-09-05 19:37:16 +02:00
2015-10-28 10:30:17 +09:00
2014-10-20 16:21:31 +02:00
2015-02-13 21:21:43 -08:00
2015-09-05 13:19:10 +02:00
2014-10-20 16:21:31 +02:00
2015-10-28 10:30:17 +09:00
2014-10-14 02:18:19 +02:00
2014-04-03 16:21:24 -07:00
2015-11-08 14:12:32 +01:00
2015-10-28 10:30:17 +09:00
2015-11-08 14:12:25 +01:00
2015-09-05 13:19:06 +02:00
2015-11-08 14:12:31 +01:00
2015-09-05 19:37:21 +02:00
2015-09-05 19:37:16 +02:00
2015-09-05 19:37:16 +02:00
2014-10-20 16:21:31 +02:00
2015-09-05 13:19:06 +02:00
2015-07-15 10:15:10 +08:00
2015-06-25 01:13:40 +02:00
2015-07-23 17:07:35 +01:00
2014-10-20 16:21:31 +02:00
2015-09-05 13:19:10 +02:00
2015-11-08 14:12:27 +01:00
2014-10-20 16:21:31 +02:00
2014-09-19 12:39:19 +02:00
2015-06-25 01:13:42 +02:00
2015-09-05 13:19:07 +02:00
2015-04-15 16:35:24 -07:00
2015-04-03 08:18:24 +02:00
2014-10-20 16:21:31 +02:00
2014-10-20 16:21:31 +02:00
2014-10-20 16:21:31 +02:00
2014-10-20 16:21:31 +02:00
2015-04-17 09:04:02 -04:00
2015-09-05 13:19:10 +02:00
2015-06-25 01:13:38 +02:00
2014-10-20 16:21:31 +02:00
2015-09-05 19:37:22 +02:00
2013-07-03 16:07:59 -07:00
2015-04-17 09:03:59 -04:00
2014-10-20 16:21:31 +02:00
2015-09-05 19:37:19 +02:00
2015-06-25 01:13:42 +02:00