[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFz8TUtKtkPzQVHAS+-RfNmd6W=CQq4BRcEux+mf8tYtqw@mail.gmail.com>
Date: Wed, 26 Nov 2014 10:23:45 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Sasha Levin <sasha.levin@...cle.com>
Cc: Andrey Ryabinin <ryabinin.a.a@...il.com>, mingo <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [RFC 2/2] kvm: eventfd: detect integer overflow using check_*_overflow
On Wed, Nov 26, 2014 at 9:55 AM, Sasha Levin <sasha.levin@...cle.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists