summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-12-11 12:10:02 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-01-07 08:46:09 +0100
commitdb80eaf6d2dfdfa258bb0c2e3d971b08d549d04f (patch)
tree638a91bf19e47a7e908b94656261bc5fbcf10e2f
parent720868011b8ddeb46346de1c82c059689264f8bb (diff)
downloadbarebox-db80eaf6d2dfdfa258bb0c2e3d971b08d549d04f.tar.gz
rtc: Check time for validity before passing it to the rtc driver
So that rtc drivers do not get invalid times. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/rtc/class.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
index 356707b..e87f5f7 100644
--- a/drivers/rtc/class.c
+++ b/drivers/rtc/class.c
@@ -46,6 +46,9 @@ EXPORT_SYMBOL(rtc_read_time);
int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
{
+ if (rtc_valid_tm(tm))
+ return -EINVAL;
+
return rtc->ops->set_time(rtc, tm);
}
EXPORT_SYMBOL(rtc_set_time);