lkml.org 
[lkml]   [2016]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/6] time: Avoid undefined behaviour in timespec64_add_safe()
On Wed, Aug 31, 2016 at 02:50:20PM -0700, John Stultz wrote:
> UBSAN: Undefined behaviour in kernel/time/time.c:783:2
> signed integer overflow:
> 5273 + 9223372036854771711 cannot be represented in type 'long int'

...

> Line 783 is this:
>
> 783 set_normalized_timespec64(&res, lhs.tv_sec + rhs.tv_sec,
> 784 lhs.tv_nsec + rhs.tv_nsec);

...

> Note that this is not currently a huge concern since the kernel should be
> built with -fno-strict-overflow by default, but could be a problem in the
> future, a problem with older compilers, or other compilers than gcc.

Is this really a concern at all? The value 9223372036854771711 is a
huge number of seconds.

Thanks,
Richard

\
 
 \ /
  Last update: 2016-09-17 09:58    [W:0.061 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site