]> git.karo-electronics.de Git - karo-tx-linux.git/commit
drivers/rtc/interface.c: fix infinite loop in initializing the alarm
authorAles Novak <alnovak@suse.cz>
Thu, 22 May 2014 00:43:46 +0000 (10:43 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 22 May 2014 00:43:46 +0000 (10:43 +1000)
commit30f6b542940a21d41d8ebfa8c90fe1c057ddc602
treea94fc40e689696a6683fe8d5ad0100037fac538c
parentd235ec79166737bd64b82248b538ad6c72741ff7
drivers/rtc/interface.c: fix infinite loop in initializing the alarm

In __rtc_read_alarm(), if the alarm time retrieved by
rtc_read_alarm_internal() from the device contains invalid values (e.g.
month=2,mday=31) and the year not set (=-1), the initialization will loop
infinitely because the year-fixing loop expects the time being invalid due
to leap year.

Fix reduces the loop to the leap years and adds final validity check.

Signed-off-by: Ales Novak <alnovak@suse.cz>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Reported-by: Jiri Bohac <jbohac@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/rtc/interface.c