* [PATCH] lib/siphash.c: mark expected switch fall-throughs
@ 2019-04-16 7:27 Stephen Rothwell
2019-04-16 9:03 ` Jason A. Donenfeld
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Rothwell @ 2019-04-16 7:27 UTC (permalink / raw)
To: Jason A. Donenfeld
Cc: Gustavo A. R. Silva, Kees Cook, Linux Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 3928 bytes --]
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: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: Gustavo A. R. Silva <gustavo@embeddedor.com>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
lib/siphash.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
Build tested on PowerPC.
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)
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 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;
+ case 3: b |= ((u64)end[2]) << 16; /* fall through */
case 2: b |= le16_to_cpup(data); break;
case 1: b |= end[0];
}
@@ -101,11 +101,11 @@ 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 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;
+ case 3: b |= ((u64)end[2]) << 16; /* fall through */
case 2: b |= get_unaligned_le16(end); break;
case 1: b |= end[0];
}
@@ -268,11 +268,11 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_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 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;
+ case 3: b |= ((u64)end[2]) << 16; /* fall through */
case 2: b |= le16_to_cpup(data); break;
case 1: b |= end[0];
}
@@ -301,11 +301,11 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
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 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;
+ case 3: b |= ((u64)end[2]) << 16; /* fall through */
case 2: b |= get_unaligned_le16(end); break;
case 1: b |= end[0];
}
@@ -431,7 +431,7 @@ 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 3: b |= ((u32)end[2]) << 16; /* fall through */
case 2: b |= le16_to_cpup(data); break;
case 1: b |= end[0];
}
@@ -454,7 +454,7 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
v0 ^= m;
}
switch (left) {
- case 3: b |= ((u32)end[2]) << 16;
+ 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
--
Cheers,
Stephen Rothwell
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] lib/siphash.c: mark expected switch fall-throughs
2019-04-16 7:27 [PATCH] lib/siphash.c: mark expected switch fall-throughs Stephen Rothwell
@ 2019-04-16 9:03 ` Jason A. Donenfeld
2019-04-25 17:46 ` Greg Kroah-Hartman
0 siblings, 1 reply; 5+ messages in thread
From: Jason A. Donenfeld @ 2019-04-16 9:03 UTC (permalink / raw)
To: Stephen Rothwell
Cc: Gustavo A. R. Silva, Kees Cook, Linux Kernel Mailing List,
Greg Kroah-Hartman
On Tue, Apr 16, 2019 at 4:27 PM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> 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: Jason A. Donenfeld <Jason@zx2c4.com>
> Cc: Gustavo A. R. Silva <gustavo@embeddedor.com>
> Cc: Kees Cook <keescook@chromium.org>
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Looks good to me, thanks for this.
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Perhaps Greg can take it through his tree?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] lib/siphash.c: mark expected switch fall-throughs
2019-04-16 9:03 ` Jason A. Donenfeld
@ 2019-04-25 17:46 ` Greg Kroah-Hartman
2019-04-25 18:03 ` Gustavo A. R. Silva
2019-04-25 20:28 ` Stephen Rothwell
0 siblings, 2 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2019-04-25 17:46 UTC (permalink / raw)
To: Jason A. Donenfeld
Cc: Stephen Rothwell, Gustavo A. R. Silva, Kees Cook,
Linux Kernel Mailing List
On Tue, Apr 16, 2019 at 06:03:58PM +0900, Jason A. Donenfeld wrote:
> On Tue, Apr 16, 2019 at 4:27 PM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> >
> > 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: Jason A. Donenfeld <Jason@zx2c4.com>
> > Cc: Gustavo A. R. Silva <gustavo@embeddedor.com>
> > Cc: Kees Cook <keescook@chromium.org>
> > Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
>
> Looks good to me, thanks for this.
>
> Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
>
> Perhaps Greg can take it through his tree?
Me? Ok, fine, I'll go queue it up...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] lib/siphash.c: mark expected switch fall-throughs
2019-04-25 17:46 ` Greg Kroah-Hartman
@ 2019-04-25 18:03 ` Gustavo A. R. Silva
2019-04-25 20:28 ` Stephen Rothwell
1 sibling, 0 replies; 5+ messages in thread
From: Gustavo A. R. Silva @ 2019-04-25 18:03 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jason A. Donenfeld
Cc: Stephen Rothwell, Kees Cook, Linux Kernel Mailing List
On 4/25/19 12:46 PM, Greg Kroah-Hartman wrote:
> On Tue, Apr 16, 2019 at 06:03:58PM +0900, Jason A. Donenfeld wrote:
>> On Tue, Apr 16, 2019 at 4:27 PM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>>>
>>> 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: Jason A. Donenfeld <Jason@zx2c4.com>
>>> Cc: Gustavo A. R. Silva <gustavo@embeddedor.com>
>>> Cc: Kees Cook <keescook@chromium.org>
>>> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
>>
>> Looks good to me, thanks for this.
>>
>> Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
>>
>> Perhaps Greg can take it through his tree?
>
> Me? Ok, fine, I'll go queue it up...
>
Thanks, Greg.
--
Gustavo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] lib/siphash.c: mark expected switch fall-throughs
2019-04-25 17:46 ` Greg Kroah-Hartman
2019-04-25 18:03 ` Gustavo A. R. Silva
@ 2019-04-25 20:28 ` Stephen Rothwell
1 sibling, 0 replies; 5+ messages in thread
From: Stephen Rothwell @ 2019-04-25 20:28 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Jason A. Donenfeld, Gustavo A. R. Silva, Kees Cook,
Linux Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 998 bytes --]
Hi Greg,
On Thu, 25 Apr 2019 19:46:15 +0200 Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
>
> On Tue, Apr 16, 2019 at 06:03:58PM +0900, Jason A. Donenfeld wrote:
> > On Tue, Apr 16, 2019 at 4:27 PM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> > >
> > > 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: Jason A. Donenfeld <Jason@zx2c4.com>
> > > Cc: Gustavo A. R. Silva <gustavo@embeddedor.com>
> > > Cc: Kees Cook <keescook@chromium.org>
> > > Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> >
> > Looks good to me, thanks for this.
> >
> > Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
> >
> > Perhaps Greg can take it through his tree?
>
> Me? Ok, fine, I'll go queue it up...
Excellent, thanks.
--
Cheers,
Stephen Rothwell
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-04-25 20:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-16 7:27 [PATCH] lib/siphash.c: mark expected switch fall-throughs Stephen Rothwell
2019-04-16 9:03 ` Jason A. Donenfeld
2019-04-25 17:46 ` Greg Kroah-Hartman
2019-04-25 18:03 ` Gustavo A. R. Silva
2019-04-25 20:28 ` Stephen Rothwell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.