mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
[PATCH] RTC class: error checks
The rtc_is_valid_tm() routine needs to treat some of the fields it checks as unsigned, to prevent wrongly accepting invalid rtc_time structs; this is the same approach used elsewhere in the RTC code for such tests. Conversely, rtc_proc_show() is missing one invalid-day-of-month test that rtc_is_valid_tm() makes: there is no day zero. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
818a8674b0
commit
db621f174d
2 changed files with 5 additions and 5 deletions
|
@ -61,7 +61,7 @@ static int rtc_proc_show(struct seq_file *seq, void *offset)
|
|||
seq_printf(seq, "%02d-", alrm.time.tm_mon + 1);
|
||||
else
|
||||
seq_printf(seq, "**-");
|
||||
if ((unsigned int)alrm.time.tm_mday <= 31)
|
||||
if (alrm.time.tm_mday && (unsigned int)alrm.time.tm_mday <= 31)
|
||||
seq_printf(seq, "%02d\n", alrm.time.tm_mday);
|
||||
else
|
||||
seq_printf(seq, "**\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue