Re: [RFC 1/2] compiler: use compiler to detect integer overflows

From: Linus Torvalds
Date: Wed Nov 26 2014 - 13:58:48 EST


On Wed, Nov 26, 2014 at 10:50 AM, Sasha Levin <sasha.levin@xxxxxxxxxx> wrote:
>
> The kernel still has it's share of *signed* integer overflows. Example? fadvise64_64():

Yes, those would definitely be worth fixing.

[ Although quite frankly, since I know gcc already knows about the
whole "check for overflow" pattern, from a QoI standpoint it is sad
that it then might optimize it away. Kind of like how it would trust
the type-based strict alias analysis more than the obvious *static*
alias analysis. Oh well ]

I don't think coccinelle can do signedness checks, though, especially
of the kind that are hidden deep behind some typedef like "loff_t".
Maybe I'm wrong. Maybe smatch can? Adding Dan Carpenter to the cc..

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/