All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Deepa Dinamani <deepa.kernel@gmail.com>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Kees Cook <keescook@chromium.org>, Jann Horn <jannh@google.com>
Subject: [PATCH] kernel/compat.c: mark expected switch fall-throughs
Date: Tue, 16 Apr 2019 17:29:37 +1000	[thread overview]
Message-ID: <20190416172937.6a7621f7@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 1601 bytes --]

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

This patch aims to suppress up to 3 missing-break-in-switch false
positives on some architectures.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Gustavo A. R. Silva <gustavo@embeddedor.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Jann Horn <jannh@google.com>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 kernel/compat.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

I know that this makes the lines longer than 80 characters, but I
though that this was better than adding new lines.

Build tested on PowerPC.

diff --git a/kernel/compat.c b/kernel/compat.c
index d8a36c6ad7c9..b61f75df188d 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -345,9 +345,9 @@ get_compat_sigset(sigset_t *set, const compat_sigset_t __user *compat)
 	if (copy_from_user(&v, compat, sizeof(compat_sigset_t)))
 		return -EFAULT;
 	switch (_NSIG_WORDS) {
-	case 4: set->sig[3] = v.sig[6] | (((long)v.sig[7]) << 32 );
-	case 3: set->sig[2] = v.sig[4] | (((long)v.sig[5]) << 32 );
-	case 2: set->sig[1] = v.sig[2] | (((long)v.sig[3]) << 32 );
+	case 4: set->sig[3] = v.sig[6] | (((long)v.sig[7]) << 32 ); /* fall through */
+	case 3: set->sig[2] = v.sig[4] | (((long)v.sig[5]) << 32 ); /* fall through */
+	case 2: set->sig[1] = v.sig[2] | (((long)v.sig[3]) << 32 ); /* fall through */
 	case 1: set->sig[0] = v.sig[0] | (((long)v.sig[1]) << 32 );
 	}
 #else
-- 
2.20.1

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2019-04-16  7:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-16  7:29 Stephen Rothwell [this message]
2019-04-16  8:32 ` [PATCH] kernel/compat.c: mark expected switch fall-throughs Arnd Bergmann
2019-04-16  8:53   ` Stephen Rothwell
2019-04-16  9:14     ` Arnd Bergmann
2019-05-15  5:23 Stephen Rothwell

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=20190416172937.6a7621f7@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=arnd@arndb.de \
    --cc=deepa.kernel@gmail.com \
    --cc=gustavo@embeddedor.com \
    --cc=jannh@google.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.