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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190313202429.20797-1-malat@debian.org>
Date:   Wed, 13 Mar 2019 21:24:29 +0100
From:   Mathieu Malaterre <malat@...ian.org>
To:     "Jason A. Donenfeld" <Jason@...c4.com>
Cc:     Mathieu Malaterre <malat@...ian.org>,
        "Gustavo A. R. Silva" <gustavo@...eddedor.com>,
        linux-kernel@...r.kernel.org
Subject: [PATCH v2] lib/siphash.c: annotate implicit fall throughs

There is a plan to build the kernel with -Wimplicit-fallthrough and
these places in the code produced warnings (W=1). Fix them up.

This commit remove the following warnings:

  lib/siphash.c:71:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
  lib/siphash.c:72:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
  lib/siphash.c:73:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
  lib/siphash.c:75:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
  lib/siphash.c:108:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
  lib/siphash.c:109:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
  lib/siphash.c:110:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
  lib/siphash.c:112:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
  lib/siphash.c:434:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
  lib/siphash.c:462:12: warning: this statement may fall through [-Wimplicit-fallthrough=]

Cc: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
Signed-off-by: Mathieu Malaterre <malat@...ian.org>
---
v2: some cases were missed in v1, update missing ones

 lib/siphash.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/siphash.c b/lib/siphash.c
index 3ae58b4edad6..f4f778d28660 100644
--- a/lib/siphash.c
+++ b/lib/siphash.c
@@ -69,10 +69,14 @@ u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key)
 #else
 	switch (left) {
 	case 7: b |= ((u64)end[6]) << 48;
+		/* fall through */
 	case 6: b |= ((u64)end[5]) << 40;
+		/* fall through */
 	case 5: b |= ((u64)end[4]) << 32;
+		/* fall through */
 	case 4: b |= le32_to_cpup(data); break;
 	case 3: b |= ((u64)end[2]) << 16;
+		/* fall through */
 	case 2: b |= le16_to_cpup(data); break;
 	case 1: b |= end[0];
 	}
@@ -102,10 +106,14 @@ u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key)
 #else
 	switch (left) {
 	case 7: b |= ((u64)end[6]) << 48;
+		/* fall through */
 	case 6: b |= ((u64)end[5]) << 40;
+		/* fall through */
 	case 5: b |= ((u64)end[4]) << 32;
+		/* fall through */
 	case 4: b |= get_unaligned_le32(end); break;
 	case 3: b |= ((u64)end[2]) << 16;
+		/* fall through */
 	case 2: b |= get_unaligned_le16(end); break;
 	case 1: b |= end[0];
 	}
@@ -432,6 +440,7 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
 	}
 	switch (left) {
 	case 3: b |= ((u32)end[2]) << 16;
+		/* fall through */
 	case 2: b |= le16_to_cpup(data); break;
 	case 1: b |= end[0];
 	}
@@ -455,6 +464,7 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
 	}
 	switch (left) {
 	case 3: b |= ((u32)end[2]) << 16;
+		/* fall through */
 	case 2: b |= get_unaligned_le16(end); break;
 	case 1: b |= end[0];
 	}
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ