From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-21.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67E68C433ED for ; Fri, 23 Apr 2021 00:32:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3EAE3613FA for ; Fri, 23 Apr 2021 00:32:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239953AbhDWAdE (ORCPT ); Thu, 22 Apr 2021 20:33:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:52252 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235302AbhDWAdD (ORCPT ); Thu, 22 Apr 2021 20:33:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 520C4613F6; Fri, 23 Apr 2021 00:32:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619137947; bh=HxcklD0m2+PXP/vIiOXF29m0Dl9QrshDlK/NZ6JeiX4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EGX3Bts2GQCYP5+LroCn6aAMaLHd4ZUVjU0s+4nvbCvIPE589xstwR/oKN0LHnlLQ 1kHNasUGRrH8AB+HDMViRw+78dSmqgQC6JzsKa+R0G4HIceLC2DndNKiWhIO67X5VK G4wIb1qjlPG7BxKknHmyMg9xJqN9D27WYwPTyyHNvosJrp6cxwms3fyUZhbc9cfOzU ca0hExb0c4WGjx3RJ7WQNLktGCITgTRV9wMg6ZQF9BOn/uLxPOucsag8xxGGO/jRM9 sm4qLr3SBOMAfxoZUVtLwdGkE4x933W9MQ3S4dbVVC7TXEjtZml4yWIlhDj8NgEPNd tROCSFGicHofQ== Date: Thu, 22 Apr 2021 17:32:21 -0700 From: Nathan Chancellor To: Nick Desaulniers Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Joe Perches , x86@kernel.org, "H. Peter Anvin" , Kees Cook , Ard Biesheuvel , Arvind Sankar , Joerg Roedel , Masahiro Yamada , Nick Terrell , Martin Radev , Vincenzo Frascino , Andrey Konovalov , linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/boot/compressed: enable -Wundef Message-ID: References: <20210422190450.3903999-1-ndesaulniers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210422190450.3903999-1-ndesaulniers@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. I wonder if it is worth turning on -Wall for this directory... > Suggested-by: Nathan Chancellor > Suggested-by: Joe Perches > Link: https://github.com/ClangBuiltLinux/linux/issues/570 > Link: https://lore.kernel.org/lkml/67f6cd269684c9aa8463ff4812c3b4605e6739c3.camel@perches.com/ > Signed-off-by: Nick Desaulniers Reviewed-by: Nathan Chancellor > --- > arch/x86/boot/compressed/Makefile | 1 + > arch/x86/boot/compressed/misc.c | 2 +- > arch/x86/boot/compressed/misc.h | 2 +- > 3 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile > index e0bc3988c3fa..77cc373c1036 100644 > --- a/arch/x86/boot/compressed/Makefile > +++ b/arch/x86/boot/compressed/Makefile > @@ -30,6 +30,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \ > > KBUILD_CFLAGS := -m$(BITS) -O2 > KBUILD_CFLAGS += -fno-strict-aliasing -fPIE > +KBUILD_CFLAGS += -Wundef > KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING > cflags-$(CONFIG_X86_32) := -march=i386 > cflags-$(CONFIG_X86_64) := -mcmodel=small -mno-red-zone > diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c > index 267e7f93050e..3a214cc3239f 100644 > --- a/arch/x86/boot/compressed/misc.c > +++ b/arch/x86/boot/compressed/misc.c > @@ -172,7 +172,7 @@ void __puthex(unsigned long value) > } > } > > -#if CONFIG_X86_NEED_RELOCS > +#ifdef CONFIG_X86_NEED_RELOCS > static void handle_relocations(void *output, unsigned long output_len, > unsigned long virt_addr) > { > diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h > index 901ea5ebec22..b140f988a233 100644 > --- a/arch/x86/boot/compressed/misc.h > +++ b/arch/x86/boot/compressed/misc.h > @@ -79,7 +79,7 @@ struct mem_vector { > u64 size; > }; > > -#if CONFIG_RANDOMIZE_BASE > +#ifdef CONFIG_RANDOMIZE_BASE > /* kaslr.c */ > void choose_random_location(unsigned long input, > unsigned long input_size, > > base-commit: 16fc44d6387e260f4932e9248b985837324705d8 > -- > 2.31.1.498.g6c1eba8ee3d-goog >