Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 12 Mar 2018 16:57:59 -0700
From: Linus Torvalds <>
To: Andrew Morton <>
Cc: Kees Cook <>, 
	Linux Kernel Mailing List <>, Josh Poimboeuf <>, 
	Rasmus Villemoes <>, "Gustavo A. R. Silva" <>, 
	"Tobin C. Harding" <>, Steven Rostedt <>, Jonathan Corbet <>, 
	Chris Mason <>, Josef Bacik <>, David Sterba <>, 
	"David S. Miller" <>, Alexey Kuznetsov <>, 
	Hideaki YOSHIFUJI <>, Ingo Molnar <>, 
	Peter Zijlstra <>, Thomas Gleixner <>, 
	Masahiro Yamada <>, Borislav Petkov <>, 
	Randy Dunlap <>, Ian Abbott <>, 
	Sergey Senozhatsky <>, Petr Mladek <>, 
	Andy Shevchenko <>, 
	Pantelis Antoniou <>, Linux Btrfs <>, 
	Network Development <>, 
	Kernel Hardening <>
Subject: Re: [PATCH v3] kernel.h: Skip single-eval logic on literals in min()/max()

On Mon, Mar 12, 2018 at 3:55 PM, Andrew Morton
<> wrote:
> Replacing the __builtin_choose_expr() with ?: works of course.

Hmm. That sounds like the right thing to do. We were so myopically
staring at the __builtin_choose_expr() problem that we overlooked the
obvious solution.

Using __builtin_constant_p() together with a ?: is in fact our common
pattern, so that should be fine. The only real reason to use
__builtin_choose_expr() is if you want to get the *type* to vary
depending on which side you choose, but that's not an issue for

> What will be the runtime effects?

There should be none. Gcc will turn the conditional for the ?: into a
constant, and DTRT.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.