1 From d6c90d2921b07a73ef87208967b0b7f7c5fdb886 Mon Sep 17 00:00:00 2001
2 From: Nathan Chancellor <natechancellor@gmail.com>
3 Date: Thu, 7 Mar 2019 14:27:56 -0700
4 Subject: x86/hw_breakpoints: Make default case in hw_breakpoint_arch_parse()
7 [ Upstream commit e898e69d6b9475bf123f99b3c5d1a67bb7cb2361 ]
9 When building with -Wsometimes-uninitialized, Clang warns:
11 arch/x86/kernel/hw_breakpoint.c:355:2: warning: variable 'align' is used
12 uninitialized whenever switch default is taken
13 [-Wsometimes-uninitialized]
15 The default cannot be reached because arch_build_bp_info() initializes
16 hw->len to one of the specified cases. Nevertheless the warning is valid
17 and returning -EINVAL makes sure that this cannot be broken by future
20 Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
21 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
22 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
23 Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
24 Cc: Borislav Petkov <bp@alien8.de>
25 Cc: "H. Peter Anvin" <hpa@zytor.com>
26 Cc: clang-built-linux@googlegroups.com
27 Link: https://github.com/ClangBuiltLinux/linux/issues/392
28 Link: https://lkml.kernel.org/r/20190307212756.4648-1-natechancellor@gmail.com
29 Signed-off-by: Sasha Levin <sashal@kernel.org>
31 arch/x86/kernel/hw_breakpoint.c | 1 +
32 1 file changed, 1 insertion(+)
34 diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c
35 index 8771766d46b6..9954a604a822 100644
36 --- a/arch/x86/kernel/hw_breakpoint.c
37 +++ b/arch/x86/kernel/hw_breakpoint.c
38 @@ -352,6 +352,7 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)