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  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:   Fri, 22 Mar 2019 09:13:18 -0700
From:   tip-bot for Nathan Chancellor <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     ndesaulniers@...gle.com, linux-kernel@...r.kernel.org,
        mingo@...nel.org, tglx@...utronix.de, bp@...en8.de, hpa@...or.com,
        natechancellor@...il.com
Subject: [tip:x86/urgent] x86/hw_breakpoints: Make default case in
 hw_breakpoint_arch_parse() return an error

Commit-ID:  e898e69d6b9475bf123f99b3c5d1a67bb7cb2361
Gitweb:     https://git.kernel.org/tip/e898e69d6b9475bf123f99b3c5d1a67bb7cb2361
Author:     Nathan Chancellor <natechancellor@...il.com>
AuthorDate: Thu, 7 Mar 2019 14:27:56 -0700
Committer:  Thomas Gleixner <tglx@...utronix.de>
CommitDate: Fri, 22 Mar 2019 17:08:17 +0100

x86/hw_breakpoints: Make default case in hw_breakpoint_arch_parse() return an error

When building with -Wsometimes-uninitialized, Clang warns:

arch/x86/kernel/hw_breakpoint.c:355:2: warning: variable 'align' is used
uninitialized whenever switch default is taken
[-Wsometimes-uninitialized]

The default cannot be reached because arch_build_bp_info() initializes
hw->len to one of the specified cases. Nevertheless the warning is valid
and returning -EINVAL makes sure that this cannot be broken by future
modifications.

Suggested-by: Nick Desaulniers <ndesaulniers@...gle.com>
Signed-off-by: Nathan Chancellor <natechancellor@...il.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: Borislav Petkov <bp@...en8.de>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: clang-built-linux@...glegroups.com
Link: https://github.com/ClangBuiltLinux/linux/issues/392
Link: https://lkml.kernel.org/r/20190307212756.4648-1-natechancellor@gmail.com

---
 arch/x86/kernel/hw_breakpoint.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c
index ff9bfd40429e..d73083021002 100644
--- a/arch/x86/kernel/hw_breakpoint.c
+++ b/arch/x86/kernel/hw_breakpoint.c
@@ -354,6 +354,7 @@ int hw_breakpoint_arch_parse(struct perf_event *bp,
 #endif
 	default:
 		WARN_ON_ONCE(1);
+		return -EINVAL;
 	}
 
 	/*

Powered by blists - more mailing lists