lkml.org 
[lkml]   [2013]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH jiffies] Avoid undefined behavior from signed overflow
On Tue, Jul 30, 2013 at 12:01:03AM +1000, Kevin Easton wrote:
> Quoting "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>:
>
> >On Mon, Jul 29, 2013 at 03:30:35PM +1000, caf@guarana.org wrote:
> >>Quoting "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>:
> >>
> ...
> >>>
> >>>Note that the C standard considers the cast from signed to
> >>>unsigned to be implementation-defined, see 6.3.1.3p3.
> ...
> >>
> >>Don't worry, the case from signed to unsigned is actually well-defined -
> >>the relevant part is 6.3.1.3p2 (in C99):
> >>
> >>>Otherwise, if the new type is unsigned, the value is converted by
> >>>repeatedly adding or subtracting one more than the maximum value that
> >>>can be represented in the new type until the value is in the range of
> >>>the new type.
> >
> >Yep, but we are going in the other direction, from unsigned to signed.
>
> Ahh, there's an error in the commit message (it says signed to unsigned).

Good catch, fixed!

Thanx, Paul



\
 
 \ /
  Last update: 2013-07-29 17:01    [W:0.089 / U:0.692 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site