[PATCH 3/7] rtc: Check time for validity before passing it to the rtc driver

Sascha Hauer s.hauer at pengutronix.de
Mon Dec 14 03:43:27 PST 2015


So that rtc drivers do not get invalid times.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/rtc/class.c | 3 +++
 1 file changed, 3 insertions(+)

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);
-- 
2.6.2




More information about the barebox mailing list