[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <874krr8dps.fsf@nanos.tec.linutronix.de>
Date: Thu, 04 Jun 2020 09:58:07 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Kees Cook <keescook@...omium.org>, linux-kernel@...r.kernel.org
Cc: Kees Cook <keescook@...omium.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
Alexander Potapenko <glider@...gle.com>,
Joe Perches <joe@...ches.com>,
Andy Whitcroft <apw@...onical.com>, x86@...nel.org,
drbd-dev@...ts.linbit.com, linux-block@...r.kernel.org,
b43-dev@...ts.infradead.org, netdev@...r.kernel.org,
linux-wireless@...r.kernel.org, linux-ide@...r.kernel.org,
linux-clk@...r.kernel.org, linux-spi@...r.kernel.org,
linux-mm@...ck.org, clang-built-linux@...glegroups.com
Subject: Re: [PATCH 01/10] x86/mm/numa: Remove uninitialized_var() usage
Kees Cook <keescook@...omium.org> writes:
> -#ifdef NODE_NOT_IN_PAGE_FLAGS
> - pfn_align = node_map_pfn_alignment();
> - if (pfn_align && pfn_align < PAGES_PER_SECTION) {
> - printk(KERN_WARNING "Node alignment %LuMB < min %LuMB, rejecting NUMA config\n",
> - PFN_PHYS(pfn_align) >> 20,
> - PFN_PHYS(PAGES_PER_SECTION) >> 20);
> - return -EINVAL;
> + if (IS_ENABLED(NODE_NOT_IN_PAGE_FLAGS)) {
Hrm, clever ...
> + unsigned long pfn_align = node_map_pfn_alignment();
> +
> + if (pfn_align && pfn_align < PAGES_PER_SECTION) {
> + pr_warn("Node alignment %LuMB < min %LuMB, rejecting NUMA config\n",
> + PFN_PHYS(pfn_align) >> 20,
> + PFN_PHYS(PAGES_PER_SECTION) >> 20);
> + return -EINVAL;
> + }
> }
> -#endif
> if (!numa_meminfo_cover_memory(mi))
> return -EINVAL;
>
> diff --git a/include/linux/page-flags-layout.h b/include/linux/page-flags-layout.h
> index 71283739ffd2..1a4cdec2bd29 100644
> --- a/include/linux/page-flags-layout.h
> +++ b/include/linux/page-flags-layout.h
> @@ -100,7 +100,7 @@
> * there. This includes the case where there is no node, so it is implicit.
> */
> #if !(NODES_WIDTH > 0 || NODES_SHIFT == 0)
> -#define NODE_NOT_IN_PAGE_FLAGS
> +#define NODE_NOT_IN_PAGE_FLAGS 1
but if we ever lose the 1 then the above will silently compile the code
within the IS_ENABLED() section out.
Thanks,
tglx
Powered by blists - more mailing lists