linux/arch
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
..
alpha mm: mlock: add mlock flags to enable VM_LOCKONFAULT usage 2015-11-05 19:34:48 -08:00
arc ARC fixes for 4.4-rc1 2015-11-14 09:09:37 -08:00
arm USB fixes for 4.4-rc2 2015-11-22 13:15:05 -08:00
arm64 arm64 fixes: 2015-11-19 12:21:23 -08:00
avr32 dmaengine updates for 4.4-rc1 2015-11-10 10:05:17 -08:00
blackfin Merge branch 'strscpy' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile 2015-10-04 16:31:13 +01:00
c6x irqdomain: Use irq_domain_get_of_node() instead of direct field access 2015-10-13 19:01:23 +02:00
cris cris: Drop reference to get_cmos_time() 2015-11-02 20:03:05 +01:00
frv kmap_atomic_to_page() has no users, remove it 2015-11-09 15:11:24 -08:00
h8300 h8300 update for v4.4 2015-11-12 15:26:39 -08:00
hexagon Linux 4.3-rc4 2015-10-06 17:10:28 +02:00
ia64 Power management and ACPI updates for v4.4-rc1 2015-11-04 18:10:13 -08:00
m32r Linux 4.3-rc4 2015-10-06 17:10:28 +02:00
m68k block: change ->make_request_fn() and users to return a queue cookie 2015-11-07 10:40:46 -07:00
metag Metag architecture changes for v4.4 2015-11-10 16:24:25 -08:00
microblaze kmap_atomic_to_page() has no users, remove it 2015-11-09 15:11:24 -08:00
mips MIPS: ath79: Add a machine entry for booting OF machines 2015-11-20 15:44:57 +01:00
mn10300 Linux 4.3-rc4 2015-10-06 17:10:28 +02:00
nios2 nios2 update for v4.4-rc1 2015-11-09 16:36:10 -08:00
openrisc dma-mapping: consolidate dma_set_mask 2015-09-10 13:29:01 -07:00
parisc Merge branch 'parisc-4.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux 2015-11-22 12:50:58 -08:00
powerpc powerpc: Remove broken GregorianDay() 2015-12-16 12:54:04 +11:00
s390 s390: remove SALIPL loader 2015-11-16 12:51:11 +01:00
score Merge branch 'strscpy' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile 2015-10-04 16:31:13 +01:00
sh Merge branch 'akpm' (patches from Andrew) 2015-11-07 14:32:45 -08:00
sparc sparc/sparc64: allocate sys_membarrier system call number 2015-11-09 15:11:24 -08:00
tile kmap_atomic_to_page() has no users, remove it 2015-11-09 15:11:24 -08:00
um um: Switch clocksource to hrtimers 2015-11-06 22:54:49 +01:00
unicore32 pwm: Changes for v4.4-rc1 2015-11-11 09:16:10 -08:00
x86 Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-11-22 12:00:12 -08:00
xtensa Merge branch 'for-4.4/io-poll' of git://git.kernel.dk/linux-block 2015-11-10 17:23:49 -08:00
.gitignore
Kconfig kexec: split kexec_load syscall from kexec core code 2015-09-10 13:29:01 -07:00