Re: [PATCH] lib/siphash.c:: annotate implicit fall throughs

From: Gustavo A. R. Silva
Date: Mon Jan 14 2019 - 16:05:08 EST




On 1/14/19 2:19 PM, Mathieu Malaterre wrote:
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:434:12: warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Mathieu Malaterre <malat@xxxxxxxxxx>


Acked-by: Gustavo A. R. Silva <gustavo@xxxxxxxxxxxxxx>


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

diff --git a/lib/siphash.c b/lib/siphash.c
index 3ae58b4edad6..b95624f5aa34 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];
}
@@ -432,6 +436,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];
}