lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2229E260-CF5A-463C-8552-32ACA97BE30F@zytor.com>
Date: Tue, 25 Feb 2025 23:17:07 -0800
From: "H. Peter Anvin" <hpa@...or.com>
To: Jiri Slaby <jirislaby@...nel.org>, Ingo Molnar <mingo@...nel.org>
CC: Uros Bizjak <ubizjak@...il.com>, x86@...nel.org,
        linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
        Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>
Subject: Re: [PATCH 1/2] x86/bootflag: Change some static functions to bool

On February 25, 2025 10:31:37 PM PST, Jiri Slaby <jirislaby@...nel.org> wrote:
>On 24. 02. 25, 19:58, Ingo Molnar wrote:
>> So this CodingStyle entry is a red herring, and the !! is absolutely
>> used in the kernel
>
>Sure, for intended conversion to either 0 or 1.
>
>> as an explicit marker of intentional type conversion
>> to bool.
>
>With this in mind, you would have to write "if (!!x)" everywhere.
>
>I don't want such constructions in code I maintain. (Nor for return values.) But this is not code I maintain (obviously), so your call after all.
>
>thanks,

Uh, no, that's not the point.

The point is that:

!!x

... is the same as 

x ? true : false

... which if promoted to an integer, intentionally or not, becomes

x ? 1 : 0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ