[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <201702241945.v1OJjDKZ011535@mail.zytor.com>
Date: Fri, 24 Feb 2017 11:45:05 -0800
From: "H. Peter Anvin" <hpa@...or.com>
To: Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>,
Andy Lutomirski <luto@...capital.net>
CC: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Andy Lutomirski <luto@...nel.org>,
Borislav Petkov <bp@...e.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Brian Gerst <brgerst@...il.com>,
Chris Metcalf <cmetcalf@...lanox.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Liang Z Li <liang.z.li@...el.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Huang Rui <ray.huang@....com>, Jiri Slaby <jslaby@...e.cz>,
Jonathan Corbet <corbet@....net>,
"Michael S. Tsirkin" <mst@...hat.com>,
Paul Gortmaker <paul.gortmaker@...driver.com>,
Vlastimil Babka <vbabka@...e.cz>,
Chen Yucong <slaoub@...il.com>,
Alexandre Julliard <julliard@...ehq.org>,
Stas Sergeev <stsp@...t.ru>, Fenghua Yu <fenghua.yu@...el.com>,
"Ravi V. Shankar" <ravi.v.shankar@...el.com>,
Shuah Khan <shuah@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
X86 ML <x86@...nel.org>, linux-msdos@...r.kernel.org,
wine-devel@...ehq.org, Tony@...or.com
Subject: Re: [PATCH v4 15/17] x86/traps: Fixup general protection faults caused by UMIP
Luck <tony.luck@...el.com>
From: hpa@...or.com
Message-ID: <C4474E45-EAE0-45D3-8DB1-78AA1C2548A8@...or.com>
On February 24, 2017 11:36:19 AM PST, Ricardo Neri <ricardo.neri-calderon@...ux.intel.com> wrote:
>On Fri, 2017-02-24 at 11:11 -0800, Andy Lutomirski wrote:
>> > In a previous version Andy Lutomirsky suggested that
>> > if (user_mode(regs) && (fixup_umip_exception(regs) == 0))
>> >
>> > was easier to read :). Although at the time fixup_umip_exception
>> > returned a numeric value. Now it only returns true/false for
>> > successful/failed emulation. If with true/false not comparing to
>> true
>> > makes it easier to read, I will make the change.
>>
>> I think == true is silly :)
>
>Then I'll make the change.
>
>Thanks and BR,
>Ricardo
It's worse than silly, it is potentially toxic.
true is a macro which it's defined as 1. Thus
foo == true
... doesn't actually mean what people *think* it does, which is roughly the same thing as
!!foo
However, if foo is not a boolean, this is *very* different; consider if foo is 2.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Powered by blists - more mailing lists