[PATCH] rtc: class: Fix max epoch in rtc_hctosys on 32-bit systems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The check for BITS_PER_LONG == 32 makes no sense after calling
tv64.tv_sec = rtc_tm_to_time64(&tm);

With this check, any 32-bit system will silently return an -ERANGE error
instead of setting the correct time if the hardware clock is storing a
date after Y2K38 (2038-01-19).
Without this check they should all work as intended, since the rest of
the function is perfectly 64-bit safe.

Fixes: f9b2a4d6a5f1 ("rtc: class: support hctosys from modular RTC drivers")

Signed-off-by: Einar Jon Gunnarsson <tolvupostur@xxxxxxxxx>
---
 drivers/rtc/class.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
index e31fa0ad127e..df58edf99ed3 100644
--- a/drivers/rtc/class.c
+++ b/drivers/rtc/class.c
@@ -72,13 +72,6 @@ static void rtc_hctosys(struct rtc_device *rtc)
 
 	tv64.tv_sec = rtc_tm_to_time64(&tm);
 
-#if BITS_PER_LONG == 32
-	if (tv64.tv_sec > INT_MAX) {
-		err = -ERANGE;
-		goto err_read;
-	}
-#endif
-
 	err = do_settimeofday64(&tv64);
 
 	dev_info(rtc->dev.parent, "setting system clock to %ptR UTC (%lld)\n",
-- 
2.34.1





[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux