]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
x86/hw_breakpoints: Make default case in hw_breakpoint_arch_parse() return an error
authorNathan Chancellor <natechancellor@gmail.com>
Thu, 7 Mar 2019 21:27:56 +0000 (14:27 -0700)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commita7b0e050200406c176b3d4bf21cbecd751a31114
treeff8083922f5f0f7c885c8214ec86e4a14b73428b
parent69a74e610a93baf46407c370cdecf3ba8f7c1993
x86/hw_breakpoints: Make default case in hw_breakpoint_arch_parse() return an error

BugLink: https://bugs.launchpad.net/bugs/1838349
[ Upstream commit e898e69d6b9475bf123f99b3c5d1a67bb7cb2361 ]

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@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: clang-built-linux@googlegroups.com
Link: https://github.com/ClangBuiltLinux/linux/issues/392
Link: https://lkml.kernel.org/r/20190307212756.4648-1-natechancellor@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
arch/x86/kernel/hw_breakpoint.c