All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] x86/sev: Remove unused variable "err" in enforce_vmpl0()
@ 2022-09-23 11:32 Li Zetao
  2022-09-23 12:19 ` Borislav Petkov
  0 siblings, 1 reply; 6+ messages in thread
From: Li Zetao @ 2022-09-23 11:32 UTC (permalink / raw)
  To: tglx, mingo, bp, dave.hansen, x86, hpa, brijesh.singh,
	michael.roth, venu.busireddy
  Cc: lizetao1, linux-kernel

Gcc report warning as follows:

arch/x86/boot/compressed/sev.c: In function ‘enforce_vmpl0’:
arch/x86/boot/compressed/sev.c:256:13: error: unused variable ‘err’
 [-Werror=unused-variable]

Fix it by removing the unused variable "err".

Fixes: 81cc3df9a90e ("x86/sev: Check the VMPL level")
Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
 arch/x86/boot/compressed/sev.c | 1 -
 1 file changed, 1 deletion(-)

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 long exit_code)
 static void enforce_vmpl0(void)
 {
 	u64 attrs;
-	int err;
 
 	/*
 	 * RMPADJUST modifies RMP permissions of a lesser-privileged (numerically
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] x86/sev: Remove unused variable "err" in enforce_vmpl0()
  2022-09-23 11:32 [PATCH -next] x86/sev: Remove unused variable "err" in enforce_vmpl0() Li Zetao
@ 2022-09-23 12:19 ` Borislav Petkov
  2022-09-24 10:18   ` Li Zetao
  0 siblings, 1 reply; 6+ messages in thread
From: Borislav Petkov @ 2022-09-23 12:19 UTC (permalink / raw)
  To: Li Zetao
  Cc: tglx, mingo, dave.hansen, x86, hpa, brijesh.singh, michael.roth,
	venu.busireddy, linux-kernel

On Fri, Sep 23, 2022 at 11:32:09AM +0000, Li Zetao wrote:
> Gcc report warning as follows:
> 
> arch/x86/boot/compressed/sev.c: In function ‘enforce_vmpl0’:
> arch/x86/boot/compressed/sev.c:256:13: error: unused variable ‘err’
>  [-Werror=unused-variable]

How do you trigger this? Compiler version and .config?

I haven't seen this one in any of my builds until now...

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] x86/sev: Remove unused variable "err" in enforce_vmpl0()
  2022-09-23 12:19 ` Borislav Petkov
@ 2022-09-24 10:18   ` Li Zetao
  2022-09-26 14:48     ` Borislav Petkov
  0 siblings, 1 reply; 6+ messages in thread
From: Li Zetao @ 2022-09-24 10:18 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: tglx, mingo, dave.hansen, x86, hpa, brijesh.singh, michael.roth,
	venu.busireddy, linux-kernel

On 2022/9/23 20:19, Borislav Petkov wrote:

> On Fri, Sep 23, 2022 at 11:32:09AM +0000, Li Zetao wrote:
>> Gcc report warning as follows:
>>
>> arch/x86/boot/compressed/sev.c: In function ‘enforce_vmpl0’:
>> arch/x86/boot/compressed/sev.c:256:13: error: unused variable ‘err’
>>   [-Werror=unused-variable]
> How do you trigger this? Compiler version and .config?
>
> I haven't seen this one in any of my builds until now...
>
> Thx.

My Compiler version is 11.2.0. I used the default .config and compiled 
with flags "-Wall -Werror", just as follows:

     make allmodconfig

     make EXTRA_CFLAGS="-Wall -Werror"


Best regards

Li Zetao


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] x86/sev: Remove unused variable "err" in enforce_vmpl0()
  2022-09-24 10:18   ` Li Zetao
@ 2022-09-26 14:48     ` Borislav Petkov
  2022-09-26 17:52       ` H. Peter Anvin
  0 siblings, 1 reply; 6+ messages in thread
From: Borislav Petkov @ 2022-09-26 14:48 UTC (permalink / raw)
  To: Li Zetao
  Cc: tglx, mingo, dave.hansen, x86, hpa, brijesh.singh, michael.roth,
	venu.busireddy, linux-kernel

On Sat, Sep 24, 2022 at 06:18:19PM +0800, Li Zetao wrote:
> My Compiler version is 11.2.0. I used the default .config and compiled with
> flags "-Wall -Werror", just as follows:
> 
>     make allmodconfig
> 
>     make EXTRA_CFLAGS="-Wall -Werror"

Ah, compressed/Makefile doesn't have -Wall. That's the old problem of
x86 not sharing makefiles. I need to dust off my patches which do that.

Now, if you do:

diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 35ce1a64068b..10abb7c45d04 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -34,7 +34,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
 # be valid.
 KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS)
 KBUILD_CFLAGS += -fno-strict-aliasing -fPIE
-KBUILD_CFLAGS += -Wundef
+KBUILD_CFLAGS += -Wundef -Wall
 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
 cflags-$(CONFIG_X86_32) := -march=i386
 cflags-$(CONFIG_X86_64) := -mcmodel=small -mno-red-zone

then allmodconfig triggers a bunch:

arch/x86/boot/compressed/efi.c: In function ‘efi_get_system_table’:
arch/x86/boot/compressed/efi.c:62:23: warning: unused variable ‘et’ [-Wunused-variable]
   62 |         enum efi_type et;
      |                       ^~
arch/x86/boot/compressed/efi.c: In function ‘efi_get_conf_table’:
arch/x86/boot/compressed/efi.c:134:13: warning: unused variable ‘ret’ [-Wunused-variable]
  134 |         int ret;
      |             ^~~
arch/x86/boot/compressed/acpi.c: In function ‘__efi_get_rsdp_addr’:
arch/x86/boot/compressed/acpi.c:27:13: warning: unused variable ‘ret’ [-Wunused-variable]
   27 |         int ret;
      |             ^~~
arch/x86/boot/compressed/acpi.c: In function ‘efi_get_rsdp_addr’:
arch/x86/boot/compressed/acpi.c:55:22: warning: unused variable ‘nr_tables’ [-Wunused-variable]
   55 |         unsigned int nr_tables;
      |                      ^~~~~~~~~
arch/x86/boot/compressed/sev.c: In function ‘enforce_vmpl0’:
arch/x86/boot/compressed/sev.c:256:13: warning: unused variable ‘err’ [-Wunused-variable]
  256 |         int err;
      |             ^~~


Would you like to do the above instead and fix them all in one go?

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] x86/sev: Remove unused variable "err" in enforce_vmpl0()
  2022-09-26 14:48     ` Borislav Petkov
@ 2022-09-26 17:52       ` H. Peter Anvin
  2022-09-26 17:59         ` Borislav Petkov
  0 siblings, 1 reply; 6+ messages in thread
From: H. Peter Anvin @ 2022-09-26 17:52 UTC (permalink / raw)
  To: Borislav Petkov, Li Zetao
  Cc: tglx, mingo, dave.hansen, x86, brijesh.singh, michael.roth,
	venu.busireddy, linux-kernel

On September 26, 2022 7:48:59 AM PDT, Borislav Petkov <bp@alien8.de> wrote:
>On Sat, Sep 24, 2022 at 06:18:19PM +0800, Li Zetao wrote:
>> My Compiler version is 11.2.0. I used the default .config and compiled with
>> flags "-Wall -Werror", just as follows:
>> 
>>     make allmodconfig
>> 
>>     make EXTRA_CFLAGS="-Wall -Werror"
>
>Ah, compressed/Makefile doesn't have -Wall. That's the old problem of
>x86 not sharing makefiles. I need to dust off my patches which do that.
>
>Now, if you do:
>
>diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
>index 35ce1a64068b..10abb7c45d04 100644
>--- a/arch/x86/boot/compressed/Makefile
>+++ b/arch/x86/boot/compressed/Makefile
>@@ -34,7 +34,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
> # be valid.
> KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS)
> KBUILD_CFLAGS += -fno-strict-aliasing -fPIE
>-KBUILD_CFLAGS += -Wundef
>+KBUILD_CFLAGS += -Wundef -Wall
> KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
> cflags-$(CONFIG_X86_32) := -march=i386
> cflags-$(CONFIG_X86_64) := -mcmodel=small -mno-red-zone
>
>then allmodconfig triggers a bunch:
>
>arch/x86/boot/compressed/efi.c: In function ‘efi_get_system_table’:
>arch/x86/boot/compressed/efi.c:62:23: warning: unused variable ‘et’ [-Wunused-variable]
>   62 |         enum efi_type et;
>      |                       ^~
>arch/x86/boot/compressed/efi.c: In function ‘efi_get_conf_table’:
>arch/x86/boot/compressed/efi.c:134:13: warning: unused variable ‘ret’ [-Wunused-variable]
>  134 |         int ret;
>      |             ^~~
>arch/x86/boot/compressed/acpi.c: In function ‘__efi_get_rsdp_addr’:
>arch/x86/boot/compressed/acpi.c:27:13: warning: unused variable ‘ret’ [-Wunused-variable]
>   27 |         int ret;
>      |             ^~~
>arch/x86/boot/compressed/acpi.c: In function ‘efi_get_rsdp_addr’:
>arch/x86/boot/compressed/acpi.c:55:22: warning: unused variable ‘nr_tables’ [-Wunused-variable]
>   55 |         unsigned int nr_tables;
>      |                      ^~~~~~~~~
>arch/x86/boot/compressed/sev.c: In function ‘enforce_vmpl0’:
>arch/x86/boot/compressed/sev.c:256:13: warning: unused variable ‘err’ [-Wunused-variable]
>  256 |         int err;
>      |             ^~~
>
>
>Would you like to do the above instead and fix them all in one go?
>
>Thx.
>

The boot code really needs to be refactored, especially that the real-mode BIOS code is built in the root of that tree.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] x86/sev: Remove unused variable "err" in enforce_vmpl0()
  2022-09-26 17:52       ` H. Peter Anvin
@ 2022-09-26 17:59         ` Borislav Petkov
  0 siblings, 0 replies; 6+ messages in thread
From: Borislav Petkov @ 2022-09-26 17:59 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Li Zetao, tglx, mingo, dave.hansen, x86, brijesh.singh,
	michael.roth, venu.busireddy, linux-kernel

On Mon, Sep 26, 2022 at 10:52:08AM -0700, H. Peter Anvin wrote:
> The boot code really needs to be refactored, especially that the
> real-mode BIOS code is built in the root of that tree.

You're going to have to expand on that a bit and give more details as to
what do you mean exactly. I think you mean arch/x86/realmode/ but I'm
not sure...

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-09-26 18:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-23 11:32 [PATCH -next] x86/sev: Remove unused variable "err" in enforce_vmpl0() Li Zetao
2022-09-23 12:19 ` Borislav Petkov
2022-09-24 10:18   ` Li Zetao
2022-09-26 14:48     ` Borislav Petkov
2022-09-26 17:52       ` H. Peter Anvin
2022-09-26 17:59         ` Borislav Petkov

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.