summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-proc.c
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2006-09-30 23:28:16 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-01 00:39:25 -0700
commitdb621f174d2c017d960089ea8cbc91c0763f1069 (patch)
tree68a6ab944fdd30b2e6a7a0fb5a06629a4f4a6af9 /drivers/rtc/rtc-proc.c
parent818a8674b0388d90e33a5d1b13946b40dda7032a (diff)
downloadlinux-db621f174d2c017d960089ea8cbc91c0763f1069.tar.gz
linux-db621f174d2c017d960089ea8cbc91c0763f1069.tar.bz2
linux-db621f174d2c017d960089ea8cbc91c0763f1069.zip
[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>
Diffstat (limited to 'drivers/rtc/rtc-proc.c')
-rw-r--r--drivers/rtc/rtc-proc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c
index 1b2c2caa2a99..2943d83edfd1 100644
--- a/drivers/rtc/rtc-proc.c
+++ b/drivers/rtc/rtc-proc.c
@@ -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");