From nobody Mon Apr 6 11:54:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F260C433F5 for ; Fri, 30 Sep 2022 03:31:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229906AbiI3Dba (ORCPT ); Thu, 29 Sep 2022 23:31:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229885AbiI3DbZ (ORCPT ); Thu, 29 Sep 2022 23:31:25 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6151E8D93 for ; Thu, 29 Sep 2022 20:31:24 -0700 (PDT) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4MdwdN0Rtvz1P6pW; Fri, 30 Sep 2022 11:27:04 +0800 (CST) Received: from kwepemm600017.china.huawei.com (7.193.23.234) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 11:31:22 +0800 Received: from huawei.com (10.67.175.88) by kwepemm600017.china.huawei.com (7.193.23.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 11:31:21 +0800 From: Li Zetao To: , , , , , , , , CC: , , , , , , , , , Subject: [PATCH -next v3 1/2] x86/boot/compressed: Add "-Wall" flag to Makefile Date: Fri, 30 Sep 2022 03:27:26 +0000 Message-ID: <20220930032727.3451619-2-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220930032727.3451619-1-lizetao1@huawei.com> References: <20220927081512.2456624-1-lizetao1@huawei.com> <20220930032727.3451619-1-lizetao1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.67.175.88] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600017.china.huawei.com (7.193.23.234) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Compressed/Makefile does not have "-Wall" flag, this is the old problem of x86 not sharing makefiles. Fix by adding "-Wall" flag to Makefile. But when "-Wall" flag added to Makefile, a few extra warnings were found. 1. In file included from arch/x86/boot/compressed/misc.c:15: In file included from arch/x86/boot/compressed/misc.h:24: In file included from ./include/linux/elf.h:6: In file included from ./arch/x86/include/asm/elf.h:8: In file included from ./include/linux/thread_info.h:60: ./arch/x86/include/asm/thread_info.h:175:13: warning: calling "__builtin_frame_address" with a nonzero argument is unsafe [-Wframe-address] oldframe =3D __builtin_frame_address(1); ^~~~~~~~~~~~~~~~~~~~~~~~~~ ./arch/x86/include/asm/thread_info.h:177:11: warning: calling "__builtin_frame_address" with a nonzero argument is unsafe [-Wframe-address] frame =3D __builtin_frame_address(2); ^~~~~~~~~~~~~~~~~~~~~~~~~~ This warning is disabled in the main Makefile for this reason so we should just be able to disable it, adding "frame-address" flag to Makefile. 2. arch/x86/boot/compressed/kaslr.c:627:6: warning: unused variable "i" [-Wunused-variable] int i; ^ This happens when CONFIG_MEMORY_HOTREMOVE or CONFIG_ACPI are "n". Fix by adding "-std=3Dgnu11" flag to Makefile, and we should put the variable "i" within the for loop. 3. arch/x86/boot/compressed/acpi.c:23:1: warning: unused function "__efi_get_rsdp_addr" [-Wunused-function] This happens when CONFIG_EFI is disabled for the reason that function "__efi_get_rsdp_addr" is only called in efi_get_rsdp_addr when CONFIG_EFI enable. So function "__efi_get_rsdp_addr" should not be defined when CONFIG_EFI is disabled. Signed-off-by: Li Zetao Reviewed-by: Nathan Chancellor --- v1 -> v2: patch is new v2 -> v3: resolve extra warnings after "-Wall" flag added. arch/x86/boot/compressed/Makefile | 3 ++- arch/x86/boot/compressed/acpi.c | 5 +++-- arch/x86/boot/compressed/kaslr.c | 3 +-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/M= akefile index 3a261abb6d15..8918a8306dff 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -35,7 +35,7 @@ targets :=3D vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.b= in.bz2 vmlinux.bin.lzma \ # be valid. KBUILD_CFLAGS :=3D -m$(BITS) -O2 $(CLANG_FLAGS) KBUILD_CFLAGS +=3D -fno-strict-aliasing -fPIE -KBUILD_CFLAGS +=3D -Wundef +KBUILD_CFLAGS +=3D -Wundef -Wall -std=3Dgnu11 KBUILD_CFLAGS +=3D -DDISABLE_BRANCH_PROFILING cflags-$(CONFIG_X86_32) :=3D -march=3Di386 cflags-$(CONFIG_X86_64) :=3D -mcmodel=3Dsmall -mno-red-zone @@ -44,6 +44,7 @@ KBUILD_CFLAGS +=3D -mno-mmx -mno-sse KBUILD_CFLAGS +=3D -ffreestanding -fshort-wchar KBUILD_CFLAGS +=3D -fno-stack-protector KBUILD_CFLAGS +=3D $(call cc-disable-warning, address-of-packed-member) +KBUILD_CFLAGS +=3D $(call cc-disable-warning, frame-address) KBUILD_CFLAGS +=3D $(call cc-disable-warning, gnu) KBUILD_CFLAGS +=3D -Wno-pointer-sign KBUILD_CFLAGS +=3D $(call cc-option,-fmacro-prefix-map=3D$(srctree)/=3D) diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acp= i.c index 9caf89063e77..79742ab34e3f 100644 --- a/arch/x86/boot/compressed/acpi.c +++ b/arch/x86/boot/compressed/acpi.c @@ -19,10 +19,10 @@ */ struct mem_vector immovable_mem[MAX_NUMNODES*2]; =20 +#ifdef CONFIG_EFI static acpi_physical_address __efi_get_rsdp_addr(unsigned long cfg_tbl_pa, unsigned int cfg_tbl_len) { -#ifdef CONFIG_EFI unsigned long rsdp_addr; int ret; =20 @@ -42,9 +42,10 @@ __efi_get_rsdp_addr(unsigned long cfg_tbl_pa, unsigned i= nt cfg_tbl_len) return (acpi_physical_address)rsdp_addr; =20 debug_putstr("Error getting RSDP address.\n"); -#endif + return 0; } +#endif =20 static acpi_physical_address efi_get_rsdp_addr(void) { diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/ka= slr.c index e476bcbd9b42..4abc9c42cf4d 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot/compressed/kaslr.c @@ -625,7 +625,6 @@ static bool process_mem_region(struct mem_vector *regio= n, unsigned long minimum, unsigned long image_size) { - int i; /* * If no immovable memory found, or MEMORY_HOTREMOVE disabled, * use @region directly. @@ -645,7 +644,7 @@ static bool process_mem_region(struct mem_vector *regio= n, * If immovable memory found, filter the intersection between * immovable memory and @region. */ - for (i =3D 0; i < num_immovable_mem; i++) { + for (int i =3D 0; i < num_immovable_mem; i++) { u64 start, end, entry_end, region_end; struct mem_vector entry; =20 --=20 2.34.1 From nobody Mon Apr 6 11:54:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E822C433F5 for ; Fri, 30 Sep 2022 03:31:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230064AbiI3Dbh (ORCPT ); Thu, 29 Sep 2022 23:31:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229975AbiI3Dba (ORCPT ); Thu, 29 Sep 2022 23:31:30 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 249A510197B for ; Thu, 29 Sep 2022 20:31:26 -0700 (PDT) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Mdwdc4LkWzWh46; Fri, 30 Sep 2022 11:27:16 +0800 (CST) Received: from kwepemm600017.china.huawei.com (7.193.23.234) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 11:31:25 +0800 Received: from huawei.com (10.67.175.88) by kwepemm600017.china.huawei.com (7.193.23.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 11:31:24 +0800 From: Li Zetao To: , , , , , , , , CC: , , , , , , , , , Subject: [PATCH -next v3 2/2] x86/boot: Remove unused variables Date: Fri, 30 Sep 2022 03:27:27 +0000 Message-ID: <20220930032727.3451619-3-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220930032727.3451619-1-lizetao1@huawei.com> References: <20220927081512.2456624-1-lizetao1@huawei.com> <20220930032727.3451619-1-lizetao1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.67.175.88] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600017.china.huawei.com (7.193.23.234) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Gcc report warning as follows: arch/x86/boot/compressed/efi.c: In function =E2=80=98efi_get_system_table= =E2=80=99: arch/x86/boot/compressed/efi.c:62:23: warning: unused variable =E2=80=98et= =E2=80=99 [-Wunused-variable] arch/x86/boot/compressed/efi.c: In function =E2=80=98efi_get_conf_table=E2= =80=99: arch/x86/boot/compressed/efi.c:134:13: warning: unused variable =E2=80=98ret=E2=80=99 [-Wunused-variable] arch/x86/boot/compressed/acpi.c: In function =E2=80=98__efi_get_rsdp_addr= =E2=80=99: arch/x86/boot/compressed/acpi.c:27:13: warning: unused variable =E2=80=98ret=E2=80=99 [-Wunused-variable] arch/x86/boot/compressed/acpi.c: In function =E2=80=98efi_get_rsdp_addr=E2= =80=99: arch/x86/boot/compressed/acpi.c:55:22: warning: unused variable =E2=80=98nr_tables=E2=80=99 [-Wunused-variable] arch/x86/boot/compressed/sev.c: In function =E2=80=98enforce_vmpl0=E2=80=99: arch/x86/boot/compressed/sev.c:256:13: error: unused variable =E2=80=98err= =E2=80=99 [-Werror=3Dunused-variable] Fix these warnings by removing unused variables. Fixes: 58f3e6b71f42 ("x86/compressed/acpi: Move EFI system table lookup to = helper") Fixes: 61c14ceda840 ("x86/compressed/acpi: Move EFI config table lookup to = helper") Fixes: dee602dd5d14 ("x86/compressed/acpi: Move EFI vendor table lookup to = helper") Fixes: f9d230e893e8 ("x86/boot: Correct RSDP parsing with 32-bit EFI") Fixes: 81cc3df9a90e ("x86/sev: Check the VMPL level") Signed-off-by: Li Zetao Reviewed-by: Nathan Chancellor --- v1 -> v2: Remove unused variables "et" in efi_get_system_table(), "ret" in=20 efi_get_conf_table(), "ret" in __efi_get_rsdp_addr() and "nr_tables" in=20 efi_get_rsdp_addr(). v2 -> v3: none arch/x86/boot/compressed/acpi.c | 2 -- arch/x86/boot/compressed/efi.c | 2 -- arch/x86/boot/compressed/sev.c | 1 - 3 files changed, 5 deletions(-) diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acp= i.c index 79742ab34e3f..ee7e689d4e0f 100644 --- a/arch/x86/boot/compressed/acpi.c +++ b/arch/x86/boot/compressed/acpi.c @@ -24,7 +24,6 @@ static acpi_physical_address __efi_get_rsdp_addr(unsigned long cfg_tbl_pa, unsigned int cfg_tbl_len) { unsigned long rsdp_addr; - int ret; =20 /* * Search EFI system tables for RSDP. Preferred is ACPI_20_TABLE_GUID to @@ -53,7 +52,6 @@ static acpi_physical_address efi_get_rsdp_addr(void) unsigned long cfg_tbl_pa =3D 0; unsigned int cfg_tbl_len; unsigned long systab_pa; - unsigned int nr_tables; enum efi_type et; int ret; =20 diff --git a/arch/x86/boot/compressed/efi.c b/arch/x86/boot/compressed/efi.c index 6edd034b0b30..6ffd22710ed2 100644 --- a/arch/x86/boot/compressed/efi.c +++ b/arch/x86/boot/compressed/efi.c @@ -59,7 +59,6 @@ unsigned long efi_get_system_table(struct boot_params *bp) { unsigned long sys_tbl_pa; struct efi_info *ei; - enum efi_type et; =20 /* Get systab from boot params. */ ei =3D &bp->efi_info; @@ -131,7 +130,6 @@ int efi_get_conf_table(struct boot_params *bp, unsigned= long *cfg_tbl_pa, { unsigned long sys_tbl_pa; enum efi_type et; - int ret; =20 if (!cfg_tbl_pa || !cfg_tbl_len) return -EINVAL; diff --git a/arch/x86/boot/compressed/sev.c b/arch/x86/boot/compressed/sev.c index c93930d5ccbd..b9451761a69a 100644 --- a/arch/x86/boot/compressed/sev.c +++ b/arch/x86/boot/compressed/sev.c @@ -253,7 +253,6 @@ void do_boot_stage2_vc(struct pt_regs *regs, unsigned l= ong exit_code) static void enforce_vmpl0(void) { u64 attrs; - int err; =20 /* * RMPADJUST modifies RMP permissions of a lesser-privileged (numerically --=20 2.34.1