Linux/linux e898e69arch/x86/kernel hw_breakpoint.c

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 at google.com>
Signed-off-by: Nathan Chancellor <natechancellor at gmail.com>
Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
Reviewed-by: Nick Desaulniers <ndesaulniers at google.com>
Cc: Borislav Petkov <bp at alien8.de>
Cc: "H. Peter Anvin" <hpa at zytor.com>
Cc: clang-built-linux at googlegroups.com
Link: https://github.com/ClangBuiltLinux/linux/issues/392
Link: https://lkml.kernel.org/r/20190307212756.4648-1-natechancellor@gmail.com

DeltaFile
+1-0arch/x86/kernel/hw_breakpoint.c
+1-01 files

UnifiedSplitRaw