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: <CAHk-=wh_+muDANgpjC6_31QMh4OnKEOgbZiD_MymHxAHRZRyqg@mail.gmail.com>
Date: Wed, 24 Jul 2024 13:02:50 -0700
From: Linus Torvalds <torvalds@...uxfoundation.org>
To: Arnd Bergmann <arnd@...nel.org>
Cc: David Laight <David.Laight@...lab.com>, 
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Matthew Wilcox <willy@...radead.org>, 
	Christoph Hellwig <hch@...radead.org>, Andrew Morton <akpm@...ux-foundation.org>, 
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>, 
	Dan Carpenter <dan.carpenter@...aro.org>, "Jason A . Donenfeld" <Jason@...c4.com>, 
	"pedro.falcato@...il.com" <pedro.falcato@...il.com>, Mateusz Guzik <mjguzik@...il.com>, 
	"linux-mm@...ck.org" <linux-mm@...ck.org>
Subject: Re: [PATCH 4/7] minmax: Simplify signedness check

On Wed, 24 Jul 2024 at 09:49, Arnd Bergmann <arnd@...nel.org> wrote:
>
> I don't understand why this return '0' for unsigned types,
> shouldn't this be
>
> ((is_unsigned_type(typeof(x)) ? 1 : __if_constexpr(x, (x) + 0, -1)) >= 0)

Yes, that looks more logical.

Plus why do that "__if_constexpr(x, (x) + 0, -1)) >= 0)" when it would
appear to be more logical to move the comparison inside, ie

  __if_constexpr(x, (x) >= 0, 0)

but I also don't see why that "+ 0" existed in the original. So
there's presumably something I'm missing.

I do get the feeling that the problem came from us being much too
clever with out min/max macros, and now this series is  doubling down
instead of saying "it wasn't really worth it".

              Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ