lkml.org 
[lkml]   [2017]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v4 15/17] x86/traps: Fixup general protection faults caused by UMIP
Luck <tony.luck@intel.com>
From: hpa@zytor.com
Message-ID: <C4474E45-EAE0-45D3-8DB1-78AA1C2548A8@zytor.com>

On February 24, 2017 11:36:19 AM PST, Ricardo Neri <ricardo.neri-calderon@linux.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.

\
 
 \ /
  Last update: 2017-02-24 20:48    [W:0.309 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site