public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Nathan Chancellor <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: ndesaulniers@google.com, linux-kernel@vger.kernel.org,
	mingo@kernel.org, tglx@linutronix.de, bp@alien8.de,
	hpa@zytor.com, natechancellor@gmail.com
Subject: [tip:x86/urgent] x86/hw_breakpoints: Make default case in hw_breakpoint_arch_parse() return an error
Date: Fri, 22 Mar 2019 09:13:18 -0700	[thread overview]
Message-ID: <tip-e898e69d6b9475bf123f99b3c5d1a67bb7cb2361@git.kernel.org> (raw)
In-Reply-To: <20190307212756.4648-1-natechancellor@gmail.com>

Commit-ID:  e898e69d6b9475bf123f99b3c5d1a67bb7cb2361
Gitweb:     https://git.kernel.org/tip/e898e69d6b9475bf123f99b3c5d1a67bb7cb2361
Author:     Nathan Chancellor <natechancellor@gmail.com>
AuthorDate: Thu, 7 Mar 2019 14:27:56 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 22 Mar 2019 17:08:17 +0100

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@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

---
 arch/x86/kernel/hw_breakpoint.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c
index ff9bfd40429e..d73083021002 100644
--- a/arch/x86/kernel/hw_breakpoint.c
+++ b/arch/x86/kernel/hw_breakpoint.c
@@ -354,6 +354,7 @@ int hw_breakpoint_arch_parse(struct perf_event *bp,
 #endif
 	default:
 		WARN_ON_ONCE(1);
+		return -EINVAL;
 	}
 
 	/*

      parent reply	other threads:[~2019-03-22 16:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-07 21:27 [PATCH] x86/hw_breakpoints: Return -EINVAL in default case in hw_breakpoint_arch_parse Nathan Chancellor
2019-03-08  0:53 ` Nick Desaulniers
2019-03-20 19:10 ` Nathan Chancellor
2019-03-22 16:13 ` tip-bot for Nathan Chancellor [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-e898e69d6b9475bf123f99b3c5d1a67bb7cb2361@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=natechancellor@gmail.com \
    --cc=ndesaulniers@google.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox