From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org
Cc: linux-kernel@vger.kernel.org,
Dominik Brodowski <linux@dominikbrodowski.net>,
Andy Lutomirski <luto@kernel.org>,
Kees Cook <keescook@chromium.org>,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Subject: [PATCH v2] x86/syscalls: Mark expected switch fall-throughs
Date: Thu, 28 Feb 2019 13:27:46 -0600 [thread overview]
Message-ID: <20190228192746.GA13021@embeddedor> (raw)
In preparation to enable -Wimplicit-fallthrough by default, mark
switch-case statements where fall-through is intentional, explicitly
in order to fix a bunch of -Wimplicit-fallthrough warnings.
In order to get the warnings mentioned above, the following
line was added to the top Makefile:
KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough=3,)
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
Changes in v2:
- Expand commit text as requested by Thomas Gleixner.
- Add Kees' Reviewed-by.
arch/x86/include/asm/syscall.h | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h
index d653139857af..04fc5c120558 100644
--- a/arch/x86/include/asm/syscall.h
+++ b/arch/x86/include/asm/syscall.h
@@ -125,23 +125,30 @@ static inline void syscall_get_arguments(struct task_struct *task,
case 0:
if (!n--) break;
*args++ = regs->bx;
+ /* fall through */
case 1:
if (!n--) break;
*args++ = regs->cx;
+ /* fall through */
case 2:
if (!n--) break;
*args++ = regs->dx;
+ /* fall through */
case 3:
if (!n--) break;
*args++ = regs->si;
+ /* fall through */
case 4:
if (!n--) break;
*args++ = regs->di;
+ /* fall through */
case 5:
if (!n--) break;
*args++ = regs->bp;
+ /* fall through */
case 6:
if (!n--) break;
+ /* fall through */
default:
BUG();
break;
@@ -152,23 +159,30 @@ static inline void syscall_get_arguments(struct task_struct *task,
case 0:
if (!n--) break;
*args++ = regs->di;
+ /* fall through */
case 1:
if (!n--) break;
*args++ = regs->si;
+ /* fall through */
case 2:
if (!n--) break;
*args++ = regs->dx;
+ /* fall through */
case 3:
if (!n--) break;
*args++ = regs->r10;
+ /* fall through */
case 4:
if (!n--) break;
*args++ = regs->r8;
+ /* fall through */
case 5:
if (!n--) break;
*args++ = regs->r9;
+ /* fall through */
case 6:
if (!n--) break;
+ /* fall through */
default:
BUG();
break;
@@ -186,23 +200,30 @@ static inline void syscall_set_arguments(struct task_struct *task,
case 0:
if (!n--) break;
regs->bx = *args++;
+ /* fall through */
case 1:
if (!n--) break;
regs->cx = *args++;
+ /* fall through */
case 2:
if (!n--) break;
regs->dx = *args++;
+ /* fall through */
case 3:
if (!n--) break;
regs->si = *args++;
+ /* fall through */
case 4:
if (!n--) break;
regs->di = *args++;
+ /* fall through */
case 5:
if (!n--) break;
regs->bp = *args++;
+ /* fall through */
case 6:
if (!n--) break;
+ /* fall through */
default:
BUG();
break;
@@ -213,23 +234,30 @@ static inline void syscall_set_arguments(struct task_struct *task,
case 0:
if (!n--) break;
regs->di = *args++;
+ /* fall through */
case 1:
if (!n--) break;
regs->si = *args++;
+ /* fall through */
case 2:
if (!n--) break;
regs->dx = *args++;
+ /* fall through */
case 3:
if (!n--) break;
regs->r10 = *args++;
+ /* fall through */
case 4:
if (!n--) break;
regs->r8 = *args++;
+ /* fall through */
case 5:
if (!n--) break;
regs->r9 = *args++;
+ /* fall through */
case 6:
if (!n--) break;
+ /* fall through */
default:
BUG();
break;
--
2.21.0
next reply other threads:[~2019-02-28 19:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-28 19:27 Gustavo A. R. Silva [this message]
2019-03-23 16:14 ` [PATCH v2] x86/syscalls: Mark expected switch fall-throughs Thomas Gleixner
2019-03-26 15:12 ` Oleg Nesterov
2019-03-26 16:09 ` Thomas Gleixner
2019-03-26 16:16 ` Steven Rostedt
2019-03-26 16:17 ` Thomas Gleixner
2019-03-27 1:26 ` Dmitry V. Levin
2019-03-27 14:29 ` Thomas Gleixner
2019-03-27 22:20 ` Dmitry V. Levin
2019-03-27 22:52 ` Thomas Gleixner
2019-03-27 23:03 ` Steven Rostedt
2019-03-27 23:12 ` Dmitry V. Levin
2019-03-27 23:15 ` Steven Rostedt
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=20190228192746.GA13021@embeddedor \
--to=gustavo@embeddedor.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@dominikbrodowski.net \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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