lkml.org 
[lkml]   [2014]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [RFC 2/2] kvm: eventfd: detect integer overflow using check_*_overflow
From
On Wed, Nov 26, 2014 at 9:55 AM, Sasha Levin <sasha.levin@oracle.com> wrote:
>
> Good point. Do you think there's an advantage in using GCC's overflow
> checker in this case?

No. However, if your coccinelle script can be changed to verify that
the type of the expression is unsigned, _that_ would be useful.

And the "multiplication overflow" may actually be a way to generate
better code. Possibly. I'm not entirely sure exactly what gcc actually
does. How many multiplication overflow tests do we actually have,
though?

For plain unsigned additions, "a + b < a" is already optimal (ie gcc
realizes it's an overflow check and generates a test against the carry
flag, at least when it doesn't screw up)

Linus


\
 
 \ /
  Last update: 2014-11-26 20:01    [W:0.064 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site