Messages in this thread | | | From | "Jason A. Donenfeld" <> | Date | Thu, 14 Mar 2019 01:01:07 -0600 | Subject | Re: [PATCH v3] lib/siphash.c: annotate implicit fall throughs |
| |
Hi Mathieu,
Thanks for getting this v3 into shape.
On Wed, Mar 13, 2019 at 3:12 PM Mathieu Malaterre <malat@debian.org> 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: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=] > > Move the break statement onto the next line to match the fall-through > comment pattern. Also move the trailing statement onto the next line to > pass checkpatch verification. > > Acked-by: "Gustavo A. R. Silva" <gustavo@embeddedor.com> > Signed-off-by: Mathieu Malaterre <malat@debian.org> > --- > v3: move break statements onto next line and please checkpatch > v2: some cases were missed in v1, update missing ones > > lib/siphash.c | 76 +++++++++++++++++++++++++++++++++++++-------------- > 1 file changed, 56 insertions(+), 20 deletions(-) > > diff --git a/lib/siphash.c b/lib/siphash.c > index 3ae58b4edad6..f459e0f4a14e 100644 > --- a/lib/siphash.c > +++ b/lib/siphash.c > @@ -68,13 +68,26 @@ u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key) > bytemask_from_count(left))); > #else > switch (left) { > - case 7: b |= ((u64)end[6]) << 48; > - case 6: b |= ((u64)end[5]) << 40; > - case 5: b |= ((u64)end[4]) << 32; > - case 4: b |= le32_to_cpup(data); break; > - case 3: b |= ((u64)end[2]) << 16; > - case 2: b |= le16_to_cpup(data); break; > - case 1: b |= end[0]; > + 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]; > } > #endif > POSTAMBLE > @@ -101,13 +114,26 @@ u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key) > bytemask_from_count(left))); > #else > switch (left) { > - case 7: b |= ((u64)end[6]) << 48; > - case 6: b |= ((u64)end[5]) << 40; > - case 5: b |= ((u64)end[4]) << 32; > - case 4: b |= get_unaligned_le32(end); break; > - case 3: b |= ((u64)end[2]) << 16; > - case 2: b |= get_unaligned_le16(end); break; > - case 1: b |= end[0]; > + 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]; > } > #endif > POSTAMBLE > @@ -431,9 +457,14 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key) > v0 ^= m; > } > switch (left) { > - case 3: b |= ((u32)end[2]) << 16; > - case 2: b |= le16_to_cpup(data); break; > - case 1: b |= end[0]; > + case 3: > + b |= ((u32)end[2]) << 16; > + /* fall through */ > + case 2: > + b |= le16_to_cpup(data); > + break; > + case 1: > + b |= end[0]; > } > HPOSTAMBLE > } > @@ -454,9 +485,14 @@ u32 __hsiphash_unaligned(const void *data, size_t len, > v0 ^= m; > } > switch (left) { > - case 3: b |= ((u32)end[2]) << 16; > - case 2: b |= get_unaligned_le16(end); break; > - case 1: b |= end[0]; > + case 3: > + b |= ((u32)end[2]) << 16; > + /* fall through */ > + case 2: > + b |= get_unaligned_le16(end); > + break; > + case 1: > + b |= end[0]; > } > HPOSTAMBLE > } > -- > 2.20.1
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Greg - would you take this through your tree?
Jason
| |