lkml.org 
[lkml]   [2020]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2] x86/boot/KASLR: Fix unused variable warning
On Fri, Jan 10, 2020 at 4:46 AM Arvind Sankar <nivedita@alum.mit.edu> wrote:
>
> On Thu, Jan 09, 2020 at 07:40:55PM +0100, Borislav Petkov wrote:
> > 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.
> >
> > https://people.kernel.org/tglx/notes-about-netiquette
>
> The boot/compressed Makefile resets KBUILD_CFLAGS. Following hack and
> building with W=1 shows it, or just add -Wunused in there.
>
> diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
> index 56aa5fa0a66b..791c0d5a952a 100644
> --- a/arch/x86/boot/compressed/Makefile
> +++ b/arch/x86/boot/compressed/Makefile
> @@ -35,6 +35,9 @@ KBUILD_CFLAGS += $(cflags-y)
> KBUILD_CFLAGS += -mno-mmx -mno-sse
> KBUILD_CFLAGS += $(call cc-option,-ffreestanding)
> KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
> +
> +include scripts/Makefile.extrawarn
> +
> KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
> KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
> KBUILD_CFLAGS += -Wno-pointer-sign

Yes. Will you send this formally? Not clear if there is other reason making
KBUILD_CFLAGS for arch/x86/boot/compressed different from other part.

Regards
Zhenzhong

\
 
 \ /
  Last update: 2020-01-10 03:28    [W:0.086 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site