Re: [PATCH] x86/boot/compressed: enable -Wundef

From: Kees Cook
Date: Thu Apr 22 2021 - 15:21:38 EST


On Thu, Apr 22, 2021 at 12:04:42PM -0700, Nick Desaulniers wrote:
> A discussion around -Wundef showed that there were still a few boolean
> Kconfigs where #if was used rather than #ifdef to guard different code.
> Kconfig doesn't define boolean configs, which can result in -Wundef
> warnings.
>
> arch/x86/boot/compressed/Makefile resets the CFLAGS used for this
> directory, and doesn't re-enable -Wundef as the top level Makefile does.
> If re-added, with RANDOMIZE_BASE and X86_NEED_RELOCS disabled, the
> following warnings are visible.
>
> arch/x86/boot/compressed/misc.h:82:5: warning: 'CONFIG_RANDOMIZE_BASE'
> is not defined, evaluates to 0 [-Wundef]
> ^
> arch/x86/boot/compressed/misc.c:175:5: warning: 'CONFIG_X86_NEED_RELOCS'
> is not defined, evaluates to 0 [-Wundef]
> ^
>
> Simply fix these and re-enable this warning for this directory.
>
> Suggested-by: Nathan Chancellor <nathan@xxxxxxxxxx>
> Suggested-by: Joe Perches <joe@xxxxxxxxxxx>
> Link: https://github.com/ClangBuiltLinux/linux/issues/570
> Link: https://lore.kernel.org/lkml/67f6cd269684c9aa8463ff4812c3b4605e6739c3.camel@xxxxxxxxxxx/
> Signed-off-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>

Thanks!

Acked-by: Kees Cook <keescook@xxxxxxxxxxxx>

--
Kees Cook