Re: [RESEND PATCH] rtc: Fix overflow when converting time64_t to rtc_time

2018-02-13 Thread Alexandre Belloni
On 26/01/2018 at 13:06:01 +0800, Baolin Wang wrote: > If we convert one large time values to rtc_time, in the original formula > 'days * 86400' can be overflowed in 'unsigned int' type to make the formula > get one incorrect remain seconds value. Thus we can use div_s64_rem() > function to avoid th

Re: [RESEND PATCH] rtc: Fix overflow when converting time64_t to rtc_time

2018-02-05 Thread Baolin Wang
Hi Alexandre, On 26 January 2018 at 17:24, Arnd Bergmann wrote: > On Fri, Jan 26, 2018 at 6:06 AM, Baolin Wang wrote: >> If we convert one large time values to rtc_time, in the original formula >> 'days * 86400' can be overflowed in 'unsigned int' type to make the formula >> get one incorrect re

Re: [RESEND PATCH] rtc: Fix overflow when converting time64_t to rtc_time

2018-01-26 Thread Arnd Bergmann
On Fri, Jan 26, 2018 at 6:06 AM, Baolin Wang wrote: > If we convert one large time values to rtc_time, in the original formula > 'days * 86400' can be overflowed in 'unsigned int' type to make the formula > get one incorrect remain seconds value. Thus we can use div_s64_rem() > function to avoid t

[RESEND PATCH] rtc: Fix overflow when converting time64_t to rtc_time

2018-01-25 Thread Baolin Wang
If we convert one large time values to rtc_time, in the original formula 'days * 86400' can be overflowed in 'unsigned int' type to make the formula get one incorrect remain seconds value. Thus we can use div_s64_rem() function to avoid this situation. Signed-off-by: Baolin Wang --- drivers/rtc/