Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rtc: rtc-isl1208: reject invalid dates

This patch for the rtc-isl1208 driver makes it reject invalid dates.

Signed-off-by: Chris Elston <celston@katalix.com>
[a.zummo@towertech.it: added comment explaining the check]
Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Cc: Hebert Valerio Riedel <hvr@gnu.org>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Chris Elston and committed by
Linus Torvalds
cc6c2ca3 c47a75a4

+7
+7
drivers/rtc/rtc-isl1208.c
··· 328 328 int sr; 329 329 u8 regs[ISL1208_RTC_SECTION_LEN] = { 0, }; 330 330 331 + /* The clock has an 8 bit wide bcd-coded register (they never learn) 332 + * for the year. tm_year is an offset from 1900 and we are interested 333 + * in the 2000-2099 range, so any value less than 100 is invalid. 334 + */ 335 + if (tm->tm_year < 100) 336 + return -EINVAL; 337 + 331 338 regs[ISL1208_REG_SC] = bin2bcd(tm->tm_sec); 332 339 regs[ISL1208_REG_MN] = bin2bcd(tm->tm_min); 333 340 regs[ISL1208_REG_HR] = bin2bcd(tm->tm_hour) | ISL1208_REG_HR_MIL;