kernel-hacking-2024-linux-s.../drivers
Maciej W. Rozycki 945185a69d rtc: rtc_time_to_tm: use unsigned arithmetic
The input argument to rtc_time_to_tm() is unsigned as well as are members of
the output structure.  However signed arithmetic is used within for
calculations leading to incorrect results for input values outside the signed
positive range.  If this happens the time of day returned is out of range.

Found the problem when fiddling with the RTC and the driver where year was set
to an unexpectedly large value like 2070, e.g.:

rtc0: setting system clock to 2070-01-01 1193046:71582832:26 UTC (3155760954)

while it should be:

rtc0: setting system clock to 2070-01-01 00:15:54 UTC (3155760954)

Changing types to unsigned fixes the problem.

[akpm@linux-foundation.org: remove old-fashioned `register' keyword]
Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: David Brownell <david-b@pacbell.net>
Cc: Dmitri Vorobiev <dmitri.vorobiev@gmail.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-05-13 08:02:25 -07:00
..
accessibility Kconfig: improved help for CONFIG_ACCESSIBILITY 2008-05-08 10:46:55 -07:00
acorn/char
acpi
amba
ata pata_atiixp: Don't disable 2008-05-06 11:43:44 -04:00
atm
auxdisplay
base Fix bogus warning in sysdev_driver_register() 2008-05-06 13:22:42 -07:00
block block: avoid duplicate calls to get_part() in disk stat code 2008-05-07 10:15:46 +02:00
bluetooth hci_usb.h: fix hard-to-trigger race 2008-05-02 16:45:10 -07:00
cdrom
char vt: fix canonical input in UTF-8 mode 2008-05-08 10:46:56 -07:00
clocksource
connector
cpufreq
cpuidle
crypto
dca
dio
dma
edac dev_name introduction fall out fix 2008-05-05 15:08:38 -07:00
eisa
firewire Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2008-05-02 13:52:35 -07:00
firmware
gpio
hid
hwmon
i2c [MIPS] Alchemy: SMBus resource fix 2008-05-12 16:46:50 +01:00
ide m68k: Fix falconide `data_adr' typo 2008-05-05 12:36:34 -07:00
ieee1394
infiniband IB/ehca: Wait for async events to finish before destroying QP 2008-05-07 11:35:06 -07:00
input Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6 2008-05-09 08:07:58 -07:00
isdn
leds
lguest
macintosh [POWERPC] macintosh: ADB driver: adb_handler_sem semaphore to mutex 2008-05-05 16:47:13 +10:00
mca
md md: fix raid5 'repair' operations 2008-05-13 08:02:24 -07:00
media i2c: Convert some more new-style drivers to use module aliasing 2008-05-11 20:37:06 +02:00
memstick
message
mfd
misc drivers/misc/sgi-xp: replace partid_t with a short 2008-05-13 08:02:23 -07:00
mmc mmc: make one-bit signed bitfields unsigned 2008-05-13 08:02:23 -07:00
mtd mtd: solutionengine flash map depends on solution engine mach group. 2008-05-08 19:51:40 +09:00
net strip: Fix termios assumption 2008-05-12 07:27:38 -07:00
nubus
of
oprofile
parisc
parport
pci
pcmcia
pnp PNP: set IRQ index in sysfs "set irq" interface 2008-05-13 08:02:24 -07:00
power Merge git://git.infradead.org/battery-2.6 2008-05-03 10:57:57 -07:00
ps3
rapidio
rtc rtc: rtc_time_to_tm: use unsigned arithmetic 2008-05-13 08:02:25 -07:00
s390 [S390] tty3270: fix put_char fail/success conversion. 2008-05-07 09:23:02 +02:00
sbus sbus: Fix bpp driver build. 2008-05-05 00:33:58 -07:00
scsi drivers/scsi/dpt_i2o.c: fix build on alpha 2008-05-08 10:46:56 -07:00
serial cris: Fix compile failure due to typo in serial driver 2008-05-12 07:27:38 -07:00
sh
sn
spi spi: pxa2xx_spi clock resume bugfix 2008-05-13 08:02:23 -07:00
ssb
tc
telephony
thermal
uio
usb Fix c67x00-ll-hpi compilation failure (bug #10627) 2008-05-12 07:30:36 -07:00
video drivers/video/pnx4008: eliminate double free 2008-05-13 08:02:24 -07:00
virtio
w1
watchdog
xen
zorro
Kconfig
Makefile