Re: [PATCH v2] x86/boot/KASLR: Fix unused variable warning

Borislav Petkov
2020-01-09T18:41:05Z

On Fri, Jan 03, 2020 at 11:39:29AM +0800, Zhenzhong Duan wrote:
> Local variable 'i' is referenced only when CONFIG_MEMORY_HOTREMOVE and
> CONFIG_ACPI are defined, but definition of variable 'i' is out of guard.
> If any of the two macros is undefined, below warning triggers during
> build, fix it by moving 'i' in the guard.
>
> arch/x86/boot/compressed/kaslr.c:698:6: warning: unused variable ‘i’ [-Wunused-variable]

How do you trigger this?

I have:

$ grep -E "(CONFIG_MEMORY_HOTREMOVE|CONFIG_ACPI)" .config
# CONFIG_ACPI is not set

but no warning. Neither with gcc 8 nor with gcc 9.

--
Regards/Gruss,
Boris.