]> Git Repo - linux.git/commitdiff
x86/hw_breakpoints: Make default case in hw_breakpoint_arch_parse() return an error
authorNathan Chancellor <[email protected]>
Thu, 7 Mar 2019 21:27:56 +0000 (14:27 -0700)
committerThomas Gleixner <[email protected]>
Fri, 22 Mar 2019 16:08:17 +0000 (17:08 +0100)
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 <[email protected]>
Signed-off-by: Nathan Chancellor <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Reviewed-by: Nick Desaulniers <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: [email protected]
Link: https://github.com/ClangBuiltLinux/linux/issues/392
Link: https://lkml.kernel.org/r/[email protected]
arch/x86/kernel/hw_breakpoint.c

index ff9bfd40429efeb7b4868d370628356e28265ec1..d7308302100276539e5c78798ee7ff013d719aa8 100644 (file)
@@ -354,6 +354,7 @@ int hw_breakpoint_arch_parse(struct perf_event *bp,
 #endif
        default:
                WARN_ON_ONCE(1);
+               return -EINVAL;
        }
 
        /*
This page took 0.057028 seconds and 4 git commands to generate.