diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2019-04-16 03:27:20 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-04-25 13:47:24 -0400 |
commit | ba2e544075c282a5bb21df7752efad3b42d6077b (patch) | |
tree | fc81c9eb298ff422f10d5686756e3a807675b663 | |
parent | ae0c2d725512f32a0d1a25f0cf2f07616d33a72e (diff) |
lib/siphash.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 18 missing-break-in-switch false
positives on some architectures.
Cc: Gustavo A. R. Silva <gustavo@embeddedor.com>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | lib/siphash.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/lib/siphash.c b/lib/siphash.c index 3ae58b4edad6..c47bb6ff2149 100644 --- a/lib/siphash.c +++ b/lib/siphash.c | |||
@@ -68,11 +68,11 @@ u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key) | |||
68 | bytemask_from_count(left))); | 68 | bytemask_from_count(left))); |
69 | #else | 69 | #else |
70 | switch (left) { | 70 | switch (left) { |
71 | case 7: b |= ((u64)end[6]) << 48; | 71 | case 7: b |= ((u64)end[6]) << 48; /* fall through */ |
72 | case 6: b |= ((u64)end[5]) << 40; | 72 | case 6: b |= ((u64)end[5]) << 40; /* fall through */ |
73 | case 5: b |= ((u64)end[4]) << 32; | 73 | case 5: b |= ((u64)end[4]) << 32; /* fall through */ |
74 | case 4: b |= le32_to_cpup(data); break; | 74 | case 4: b |= le32_to_cpup(data); break; |
75 | case 3: b |= ((u64)end[2]) << 16; | 75 | case 3: b |= ((u64)end[2]) << 16; /* fall through */ |
76 | case 2: b |= le16_to_cpup(data); break; | 76 | case 2: b |= le16_to_cpup(data); break; |
77 | case 1: b |= end[0]; | 77 | case 1: b |= end[0]; |
78 | } | 78 | } |
@@ -101,11 +101,11 @@ u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key) | |||
101 | bytemask_from_count(left))); | 101 | bytemask_from_count(left))); |
102 | #else | 102 | #else |
103 | switch (left) { | 103 | switch (left) { |
104 | case 7: b |= ((u64)end[6]) << 48; | 104 | case 7: b |= ((u64)end[6]) << 48; /* fall through */ |
105 | case 6: b |= ((u64)end[5]) << 40; | 105 | case 6: b |= ((u64)end[5]) << 40; /* fall through */ |
106 | case 5: b |= ((u64)end[4]) << 32; | 106 | case 5: b |= ((u64)end[4]) << 32; /* fall through */ |
107 | case 4: b |= get_unaligned_le32(end); break; | 107 | case 4: b |= get_unaligned_le32(end); break; |
108 | case 3: b |= ((u64)end[2]) << 16; | 108 | case 3: b |= ((u64)end[2]) << 16; /* fall through */ |
109 | case 2: b |= get_unaligned_le16(end); break; | 109 | case 2: b |= get_unaligned_le16(end); break; |
110 | case 1: b |= end[0]; | 110 | case 1: b |= end[0]; |
111 | } | 111 | } |
@@ -268,11 +268,11 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key) | |||
268 | bytemask_from_count(left))); | 268 | bytemask_from_count(left))); |
269 | #else | 269 | #else |
270 | switch (left) { | 270 | switch (left) { |
271 | case 7: b |= ((u64)end[6]) << 48; | 271 | case 7: b |= ((u64)end[6]) << 48; /* fall through */ |
272 | case 6: b |= ((u64)end[5]) << 40; | 272 | case 6: b |= ((u64)end[5]) << 40; /* fall through */ |
273 | case 5: b |= ((u64)end[4]) << 32; | 273 | case 5: b |= ((u64)end[4]) << 32; /* fall through */ |
274 | case 4: b |= le32_to_cpup(data); break; | 274 | case 4: b |= le32_to_cpup(data); break; |
275 | case 3: b |= ((u64)end[2]) << 16; | 275 | case 3: b |= ((u64)end[2]) << 16; /* fall through */ |
276 | case 2: b |= le16_to_cpup(data); break; | 276 | case 2: b |= le16_to_cpup(data); break; |
277 | case 1: b |= end[0]; | 277 | case 1: b |= end[0]; |
278 | } | 278 | } |
@@ -301,11 +301,11 @@ u32 __hsiphash_unaligned(const void *data, size_t len, | |||
301 | bytemask_from_count(left))); | 301 | bytemask_from_count(left))); |
302 | #else | 302 | #else |
303 | switch (left) { | 303 | switch (left) { |
304 | case 7: b |= ((u64)end[6]) << 48; | 304 | case 7: b |= ((u64)end[6]) << 48; /* fall through */ |
305 | case 6: b |= ((u64)end[5]) << 40; | 305 | case 6: b |= ((u64)end[5]) << 40; /* fall through */ |
306 | case 5: b |= ((u64)end[4]) << 32; | 306 | case 5: b |= ((u64)end[4]) << 32; /* fall through */ |
307 | case 4: b |= get_unaligned_le32(end); break; | 307 | case 4: b |= get_unaligned_le32(end); break; |
308 | case 3: b |= ((u64)end[2]) << 16; | 308 | case 3: b |= ((u64)end[2]) << 16; /* fall through */ |
309 | case 2: b |= get_unaligned_le16(end); break; | 309 | case 2: b |= get_unaligned_le16(end); break; |
310 | case 1: b |= end[0]; | 310 | case 1: b |= end[0]; |
311 | } | 311 | } |
@@ -431,7 +431,7 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key) | |||
431 | v0 ^= m; | 431 | v0 ^= m; |
432 | } | 432 | } |
433 | switch (left) { | 433 | switch (left) { |
434 | case 3: b |= ((u32)end[2]) << 16; | 434 | case 3: b |= ((u32)end[2]) << 16; /* fall through */ |
435 | case 2: b |= le16_to_cpup(data); break; | 435 | case 2: b |= le16_to_cpup(data); break; |
436 | case 1: b |= end[0]; | 436 | case 1: b |= end[0]; |
437 | } | 437 | } |
@@ -454,7 +454,7 @@ u32 __hsiphash_unaligned(const void *data, size_t len, | |||
454 | v0 ^= m; | 454 | v0 ^= m; |
455 | } | 455 | } |
456 | switch (left) { | 456 | switch (left) { |
457 | case 3: b |= ((u32)end[2]) << 16; | 457 | case 3: b |= ((u32)end[2]) << 16; /* fall through */ |
458 | case 2: b |= get_unaligned_le16(end); break; | 458 | case 2: b |= get_unaligned_le16(end); break; |
459 | case 1: b |= end[0]; | 459 | case 1: b |= end[0]; |
460 | } | 460 | } |