On Thu, Jun 04, 2020 at 11:39:05PM +0200, Thomas Gleixner wrote:
> Kees Cook writes:
> >> > -#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.
> >
> >
Kees Cook writes:
>> > -#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.
>
> That's true, yes. I considered two other ways to do this:
>
> 1) smallest patch,
On Thu, Jun 4, 2020 at 4:56 PM Kees Cook 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]
On Thu, Jun 04, 2020 at 01:41:07PM +0200, Miguel Ojeda wrote:
> On Thu, Jun 4, 2020 at 9:58 AM Thomas Gleixner wrote:
> >
> > but if we ever lose the 1 then the above will silently compile the code
> > within the IS_ENABLED() section out.
>
> Yeah, I believe `IS_ENABLED()` is only meant for Kconf
On Thu, Jun 04, 2020 at 09:58:07AM +0200, Thomas Gleixner wrote:
> Kees Cook 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,
>
On Thu, Jun 4, 2020 at 9:58 AM Thomas Gleixner wrote:
>
> but if we ever lose the 1 then the above will silently compile the code
> within the IS_ENABLED() section out.
Yeah, I believe `IS_ENABLED()` is only meant for Kconfig symbols, not
macro defs in general. A better option would be `__is_defi
Kees Cook 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)
Using uninitialized_var() is dangerous as it papers over real bugs[1]
(or can in the future), and suppresses unrelated compiler warnings (e.g.
"unused variable"). If the compiler thinks it is uninitialized, either
simply initialize the variable or make compiler changes. As a precursor
to removing[2