[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <569ab24c68bb46ae99600b9b309ebcbd@AcuMS.aculab.com>
Date: Tue, 13 Mar 2018 13:31:24 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Linus Torvalds' <torvalds@...ux-foundation.org>,
Kees Cook <keescook@...omium.org>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
"Rasmus Villemoes" <linux@...musvillemoes.dk>,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>,
"Tobin C. Harding" <me@...in.cc>,
Steven Rostedt <rostedt@...dmis.org>,
Jonathan Corbet <corbet@....net>, Chris Mason <clm@...com>,
Josef Bacik <jbacik@...com>, David Sterba <dsterba@...e.com>,
"David S. Miller" <davem@...emloft.net>,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
"Ingo Molnar" <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
"Thomas Gleixner" <tglx@...utronix.de>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Borislav Petkov <bp@...e.de>,
Randy Dunlap <rdunlap@...radead.org>,
Ian Abbott <abbotti@....co.uk>,
Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
Petr Mladek <pmladek@...e.com>,
"Andy Shevchenko" <andriy.shevchenko@...ux.intel.com>,
Pantelis Antoniou <pantelis.antoniou@...sulko.com>,
Linux Btrfs <linux-btrfs@...r.kernel.org>,
Network Development <netdev@...r.kernel.org>,
Kernel Hardening <kernel-hardening@...ts.openwall.com>
Subject: RE: [PATCH v3] kernel.h: Skip single-eval logic on literals in
min()/max()
The amount of replicated defined could also be reduced by passing > or <
to a min_max() macro.
So you start off with something like:
#define min(x, y) __min_max(x, <, y)
#define max(x, y) __min_max(x, >, y)
then have:
#define __min_max(x, cond, y) ((x) cond (y) ? (x) : (y))
in all its associated flavours.
David
Powered by blists - more mailing lists