]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-5.0/x86-hw_breakpoints-make-default-case-in-hw_breakpoin.patch
patches for 4.4
[thirdparty/kernel/stable-queue.git] / queue-5.0 / x86-hw_breakpoints-make-default-case-in-hw_breakpoin.patch
CommitLineData
26c4d3b8
SLM
1From c59bb028007484b243e2fe3696e60c3cee399df7 Mon Sep 17 00:00:00 2001
2From: Nathan Chancellor <natechancellor@gmail.com>
3Date: Thu, 7 Mar 2019 14:27:56 -0700
4Subject: x86/hw_breakpoints: Make default case in hw_breakpoint_arch_parse()
5 return an error
6
7[ Upstream commit e898e69d6b9475bf123f99b3c5d1a67bb7cb2361 ]
8
9When building with -Wsometimes-uninitialized, Clang warns:
10
11arch/x86/kernel/hw_breakpoint.c:355:2: warning: variable 'align' is used
12uninitialized whenever switch default is taken
13[-Wsometimes-uninitialized]
14
15The default cannot be reached because arch_build_bp_info() initializes
16hw->len to one of the specified cases. Nevertheless the warning is valid
17and returning -EINVAL makes sure that this cannot be broken by future
18modifications.
19
20Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
21Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
22Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
23Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
24Cc: Borislav Petkov <bp@alien8.de>
25Cc: "H. Peter Anvin" <hpa@zytor.com>
26Cc: clang-built-linux@googlegroups.com
27Link: https://github.com/ClangBuiltLinux/linux/issues/392
28Link: https://lkml.kernel.org/r/20190307212756.4648-1-natechancellor@gmail.com
29Signed-off-by: Sasha Levin <sashal@kernel.org>
30---
31 arch/x86/kernel/hw_breakpoint.c | 1 +
32 1 file changed, 1 insertion(+)
33
34diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c
35index 34a5c1715148..2882fe1d2a78 100644
36--- a/arch/x86/kernel/hw_breakpoint.c
37+++ b/arch/x86/kernel/hw_breakpoint.c
38@@ -357,6 +357,7 @@ int hw_breakpoint_arch_parse(struct perf_event *bp,
39 #endif
40 default:
41 WARN_ON_ONCE(1);
42+ return -EINVAL;
43 }
44
45 /*
46--
472.19.1
48