lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 24 Oct 2016 18:44:24 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        "H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Borislav Petkov <bp@...e.de>, Andi Kleen <ak@...ux.intel.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf/x86: always warn about broken BIOS

On Mon, Oct 24, 2016 at 05:26:37PM +0200, Arnd Bergmann wrote:
> The intialization function checks for various failure scenarios, but
> unfortunately the compiler gets a little confused about the possible
> combinations, leading to a false-positive build warning when
> -Wmaybe-uninitialized is set:
> 
> arch/x86/events/core.c: In function ‘init_hw_perf_events’:
> arch/x86/events/core.c:264:3: warning: ‘reg_fail’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> arch/x86/events/core.c:264:3: warning: ‘val_fail’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>    pr_err(FW_BUG "the BIOS has corrupted hw-PMU resources (MSR %x is %Lx)\n",
> 
> It seems reasonable to move the check for the broken BIOS a little
> higher in the function, which will lead to the kernel warning about
> both the BIOS and and broken hardware if both are faulty, but it
> has no effect otherwise at runtime.
> 
> Moving it ahead of the check for broken hardware however gets rid
> of the compile-time warning.
> 
> Signed-off-by: Arnd Bergmann <arnd@...db.de>


Wouldn't something simple like this not be, well, simpler?
---

 arch/x86/events/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index d31735f37ed7..3bc4d76ce0bb 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -190,8 +190,8 @@ static void release_pmc_hardware(void) {}
 
 static bool check_hw_exists(void)
 {
-	u64 val, val_fail, val_new= ~0;
-	int i, reg, reg_fail, ret = 0;
+	u64 val, val_fail = 0, val_new= ~0;
+	int i, reg, reg_fail = 0, ret = 0;
 	int bios_fail = 0;
 	int reg_safe = -1;
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ