From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a8RXn-0001LH-Jn for barebox@lists.infradead.org; Mon, 14 Dec 2015 11:43:58 +0000 From: Sascha Hauer Date: Mon, 14 Dec 2015 12:43:27 +0100 Message-Id: <1450093411-13885-3-git-send-email-s.hauer@pengutronix.de> In-Reply-To: <1450093411-13885-1-git-send-email-s.hauer@pengutronix.de> References: <1450093411-13885-1-git-send-email-s.hauer@pengutronix.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 3/7] rtc: Check time for validity before passing it to the rtc driver To: Barebox List So that rtc drivers do not get invalid times. Signed-off-by: Sascha Hauer --- 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 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox