From: "Uecker, Martin" <Martin.Uecker@med.uni-goettingen.de>
To: "torvalds@linux-foundation.org" <torvalds@linux-foundation.org>,
"keescook@chromium.org" <keescook@chromium.org>
Cc: "mingo@kernel.org" <mingo@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"rdunlap@infradead.org" <rdunlap@infradead.org>,
"abbotti@mev.co.uk" <abbotti@mev.co.uk>,
"linux@rasmusvillemoes.dk" <linux@rasmusvillemoes.dk>,
"miguel.ojeda.sandonis@gmail.com"
<miguel.ojeda.sandonis@gmail.com>,
"jpoimboe@redhat.com" <jpoimboe@redhat.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"kernel-hardening@lists.openwall.com"
<kernel-hardening@lists.openwall.com>,
"David.Laight@aculab.com" <David.Laight@aculab.com>
Subject: Re: [PATCH v6] kernel.h: Retain constant expression output for max()/min()
Date: Tue, 27 Mar 2018 12:00:55 +0000 [thread overview]
Message-ID: <1522152055.3889.4.camel@med.uni-goettingen.de> (raw)
In-Reply-To: <CA+55aFw2Jn=ispuj1Xzj_RwPPMR3-1eYTi+BFo+2-d07AJBQJw@mail.gmail.com>
To give credit where credit is due, this hack was inspired by
an equally insane (but different) use of the ?: operator to choose
the right return type for type-generic macros in tgmath.h.
https://sourceware.org/git/?p=glibc.git;a=blob;f=math/tgmath.h;h=a709a5
9d0fa1168ef03349561169fc5bd27d65aa;hb=d8742dd82f6a00601155c69bad3012e90
5591e1f
(recommendation: don't look)
Martin
Am Montag, den 26.03.2018, 14:52 -1000 schrieb Linus Torvalds:
> On Mon, Mar 26, 2018 at 12:15 PM, Kees Cook <keescook@chromium.org>
> wrote:
> >
> > This patch updates the min()/max() macros to evaluate to a constant
> > expression when called on constant expression arguments.
>
> Ack.
>
> I'm of two minds whether that "__is_constant()" macro should be
> explained or not.
>
> A small voice in my head says "that wants a comment".
>
> But a bigger voice disagrees.
>
> It is a work of art, and maybe the best documentation is just the
> name. It does what it says it does.
>
> Art shouldn't be explained. It should be appreciated.
>
> Nobody sane really should care about how it works, and if somebody
> cares it is "left as an exercise to the reader".
>
> Linus
next prev parent reply other threads:[~2018-03-27 12:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-26 22:15 Kees Cook
2018-03-27 0:52 ` Linus Torvalds
2018-03-27 12:00 ` Uecker, Martin [this message]
2018-03-27 5:47 ` Ingo Molnar
2018-03-31 4:57 ` Kees Cook
2018-03-31 5:34 ` Ingo Molnar
2018-03-31 13:37 ` Kees Cook
2018-03-27 8:55 ` David Laight
2018-03-27 10:03 ` Miguel Ojeda
2018-03-27 10:43 ` kbuild test robot
2018-03-27 18:39 ` kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1522152055.3889.4.camel@med.uni-goettingen.de \
--to=martin.uecker@med.uni-goettingen.de \
--cc=David.Laight@aculab.com \
--cc=abbotti@mev.co.uk \
--cc=akpm@linux-foundation.org \
--cc=jpoimboe@redhat.com \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=mingo@kernel.org \
--cc=rdunlap@infradead.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®