[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72mHhzfPMGbBn=NZfqLeejPG+t=GN++NJ-L0hg-2x4UPag@mail.gmail.com>
Date: Thu, 4 Jun 2020 17:22:15 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Kees Cook <keescook@...omium.org>
Cc: Thomas Gleixner <tglx@...utronix.de>,
linux-kernel <linux-kernel@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Alexander Potapenko <glider@...gle.com>,
Joe Perches <joe@...ches.com>,
Andy Whitcroft <apw@...onical.com>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
drbd-dev@...ts.linbit.com, linux-block@...r.kernel.org,
b43-dev@...ts.infradead.org,
Network Development <netdev@...r.kernel.org>,
linux-wireless <linux-wireless@...r.kernel.org>,
linux-ide@...r.kernel.org, linux-clk@...r.kernel.org,
linux-spi@...r.kernel.org, Linux-MM <linux-mm@...ck.org>,
clang-built-linux <clang-built-linux@...glegroups.com>,
Masahiro Yamada <masahiroy@...nel.org>
Subject: Re: [PATCH 01/10] x86/mm/numa: Remove uninitialized_var() usage
On Thu, Jun 4, 2020 at 4:56 PM Kees Cook <keescook@...omium.org> wrote:
>
> Er? That's not what it looked like to me:
>
> #define IS_BUILTIN(option) __is_defined(option)
> #define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option))
>
> But just to be sure, I just tested in with a real build:
>
> [ 3.242160] IS_ENABLED(TEST_UNDEF) false
> [ 3.242691] __is_defined(TEST_UNDEF) false
> [ 3.243240] IS_ENABLED(TEST_VALUE_EMPTY) false
> [ 3.243794] __is_defined(TEST_VALUE_EMPTY) false
> [ 3.244353] IS_ENABLED(TEST_VALUE_1) true
> [ 3.244848] __is_defined(TEST_VALUE_1) true
>
> and nope, it only works with a defined value present.
You are right, it follows the Kconfig logic, returning false for
defined-but-to-0 too.
We should probably add an `IS_DEFINED()` macro kernel-wide for this
(and add it to the `coding-guidelines.rst` since `IS_ENABLED()` is
mentioned there, with a warning not to mix it with `__is_defined()`
which looks it was only intended as an implementation detail for
`include/linux/kconfig.h`).
CC'ing Masahiro by the way.
Cheers,
Miguel
Powered by blists - more mailing lists