[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <53C9889F.3040107@zytor.com>
Date: Fri, 18 Jul 2014 13:50:39 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Andy Lutomirski <luto@...capital.net>
CC: Stephen Rothwell <sfr@...b.auug.org.au>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...e.hu>,
Peter Zijlstra <peterz@...radead.org>,
"linux-next@...r.kernel.org" <linux-next@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: linux-next: build warning after merge of the tip tree
On 07/18/2014 01:20 PM, Andy Lutomirski wrote:
>>
>> The reason this is a concern is that: (x > x + n) and its variants is
>> often used to mean (x > INT_MAX - n) without the type knowledge, but
>> that is actually invalid standard C because signed types are not
>> guaranteed to wrap.
>
> Right, but the constant in this case is *much* less than INT_MAX.
> Anyway, this is moot.
It isn't about the constant (n) at all, it is about the value of x.
> I do wonder whether the kind of people who build hardened kernels
> should enable -fwrapv, though.
-fwrapv in gcc makes signed arithmetic strict 2's-complement, which is
what I think we want in the kernel. Someone would just have to make
sure there isn't some key codepath in the kernel which gets pessimized.
-hpa
--
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