lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190416172937.6a7621f7@canb.auug.org.au>
Date:   Tue, 16 Apr 2019 17:29:37 +1000
From:   Stephen Rothwell <sfr@...b.auug.org.au>
To:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Cc:     Arnd Bergmann <arnd@...db.de>,
        Deepa Dinamani <deepa.kernel@...il.com>,
        "Gustavo A. R. Silva" <gustavo@...eddedor.com>,
        Kees Cook <keescook@...omium.org>, Jann Horn <jannh@...gle.com>
Subject: [PATCH] kernel/compat.c: mark expected switch fall-throughs

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@...db.de>
Cc: Deepa Dinamani <deepa.kernel@...il.com>
Cc: Gustavo A. R. Silva <gustavo@...eddedor.com>
Cc: Kees Cook <keescook@...omium.org>
Cc: Jann Horn <jannh@...gle.com>
Signed-off-by: Stephen Rothwell <sfr@...b.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

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ