All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arvind Sankar <nivedita@alum.mit.edu>
To: Borislav Petkov <bp@alien8.de>
Cc: Zhenzhong Duan <zhenzhong.duan@gmail.com>,
	linux-kernel@vger.kernel.org, x86@kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@suse.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Chao Fan <fanc.fnst@cn.fujitsu.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Subject: Re: [PATCH v2] x86/boot/KASLR: Fix unused variable warning
Date: Thu, 9 Jan 2020 15:46:41 -0500	[thread overview]
Message-ID: <20200109204638.GA523773@rani.riverdale.lan> (raw)
In-Reply-To: <20200109184055.GI5603@zn.tnic>

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

  reply	other threads:[~2020-01-09 20:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-03  3:39 [PATCH v2] x86/boot/KASLR: Fix unused variable warning Zhenzhong Duan
2020-01-09 18:40 ` Borislav Petkov
2020-01-09 20:46   ` Arvind Sankar [this message]
2020-01-09 20:50     ` Borislav Petkov
2020-01-10  2:09       ` Zhenzhong Duan
2020-01-10  8:27         ` Borislav Petkov
2020-01-10  8:36           ` Zhenzhong Duan
2020-01-10  9:01             ` Borislav Petkov
2020-01-10  2:27     ` Zhenzhong Duan
2020-01-10  9:00       ` Borislav Petkov
2020-01-13  2:43         ` Zhenzhong Duan
2020-01-24 11:09           ` Borislav Petkov
2020-01-09 21:00 ` Thomas Gleixner
2020-01-10  8:46   ` Zhenzhong Duan
2020-01-10 13:13     ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200109204638.GA523773@rani.riverdale.lan \
    --to=nivedita@alum.mit.edu \
    --cc=bp@alien8.de \
    --cc=bp@suse.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=fanc.fnst@cn.fujitsu.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=zhenzhong.duan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.