diff --git a/drivers/rtc/rtc-lib.c b/drivers/rtc/rtc-lib.c index a9db79f80951c4b45e2456cb4e911ef95aebd86e..48227002bbfd9a09e29b0b22dec04e18f97e95ee 100644 --- a/drivers/rtc/rtc-lib.c +++ b/drivers/rtc/rtc-lib.c @@ -101,7 +101,7 @@ int rtc_valid_tm(struct rtc_time *tm) || ((unsigned)tm->tm_mon) >= 12 || tm->tm_mday < 1 || tm->tm_year > (INT_MAX - 1900) - || tm->tm_mday > rtc_month_days(tm->tm_mon, tm->tm_year + 1900) + || tm->tm_mday > rtc_month_days(tm->tm_mon, ((unsigned)tm->tm_year + 1900)) || ((unsigned)tm->tm_hour) >= 24 || ((unsigned)tm->tm_min) >= 60 || ((unsigned)tm->tm_sec) >= 60) @@ -117,8 +117,8 @@ EXPORT_SYMBOL(rtc_valid_tm); */ time64_t rtc_tm_to_time64(struct rtc_time *tm) { - return mktime64(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec); + return mktime64(((unsigned)tm->tm_year + 1900), tm->tm_mon + 1, + tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); } EXPORT_SYMBOL(rtc_tm_to_time64);