* [PATCH] skbuff: Mark expected switch fall-throughs
@ 2018-10-13 11:56 Gustavo A. R. Silva
2018-10-15 21:30 ` Kees Cook
0 siblings, 1 reply; 4+ messages in thread
From: Gustavo A. R. Silva @ 2018-10-13 11:56 UTC (permalink / raw)
To: Andrew Morton, Kees Cook; +Cc: linux-kernel, Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
include/linux/skbuff.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 119d092..92ec346 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -3505,13 +3505,19 @@ static inline bool __skb_metadata_differs(const struct sk_buff *skb_a,
#define __it(x, op) (x -= sizeof(u##op))
#define __it_diff(a, b, op) (*(u##op *)__it(a, op)) ^ (*(u##op *)__it(b, op))
case 32: diffs |= __it_diff(a, b, 64);
+ /* fall through */
case 24: diffs |= __it_diff(a, b, 64);
+ /* fall through */
case 16: diffs |= __it_diff(a, b, 64);
+ /* fall through */
case 8: diffs |= __it_diff(a, b, 64);
break;
case 28: diffs |= __it_diff(a, b, 64);
+ /* fall through */
case 20: diffs |= __it_diff(a, b, 64);
+ /* fall through */
case 12: diffs |= __it_diff(a, b, 64);
+ /* fall through */
case 4: diffs |= __it_diff(a, b, 32);
break;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] skbuff: Mark expected switch fall-throughs
2018-10-13 11:56 [PATCH] skbuff: Mark expected switch fall-throughs Gustavo A. R. Silva
@ 2018-10-15 21:30 ` Kees Cook
2018-10-16 22:41 ` Kees Cook
0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2018-10-15 21:30 UTC (permalink / raw)
To: Gustavo A. R. Silva; +Cc: Andrew Morton, LKML
On Sat, Oct 13, 2018 at 4:56 AM, Gustavo A. R. Silva
<gustavo@embeddedor.com> wrote:
> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> where we are expecting to fall through.
>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Kees Cook <keescook@chromium.org>
-Kees
> ---
> include/linux/skbuff.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index 119d092..92ec346 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -3505,13 +3505,19 @@ static inline bool __skb_metadata_differs(const struct sk_buff *skb_a,
> #define __it(x, op) (x -= sizeof(u##op))
> #define __it_diff(a, b, op) (*(u##op *)__it(a, op)) ^ (*(u##op *)__it(b, op))
> case 32: diffs |= __it_diff(a, b, 64);
> + /* fall through */
> case 24: diffs |= __it_diff(a, b, 64);
> + /* fall through */
> case 16: diffs |= __it_diff(a, b, 64);
> + /* fall through */
> case 8: diffs |= __it_diff(a, b, 64);
> break;
> case 28: diffs |= __it_diff(a, b, 64);
> + /* fall through */
> case 20: diffs |= __it_diff(a, b, 64);
> + /* fall through */
> case 12: diffs |= __it_diff(a, b, 64);
> + /* fall through */
> case 4: diffs |= __it_diff(a, b, 32);
> break;
> }
> --
> 2.7.4
>
--
Kees Cook
Pixel Security
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] skbuff: Mark expected switch fall-throughs
2018-10-15 21:30 ` Kees Cook
@ 2018-10-16 22:41 ` Kees Cook
2018-10-17 10:55 ` Gustavo A. R. Silva
0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2018-10-16 22:41 UTC (permalink / raw)
To: Gustavo A. R. Silva; +Cc: Andrew Morton, LKML
On Mon, Oct 15, 2018 at 2:30 PM, Kees Cook <keescook@chromium.org> wrote:
> On Sat, Oct 13, 2018 at 4:56 AM, Gustavo A. R. Silva
> <gustavo@embeddedor.com> wrote:
>> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
>> where we are expecting to fall through.
>>
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>
> Acked-by: Kees Cook <keescook@chromium.org>
Actually, since this is skbuff, can you resend this to netdev instead?
Andrew took the other two, but this one seems like it should go via
David Miller.
Thanks!
-Kees
>
> -Kees
>
>> ---
>> include/linux/skbuff.h | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
>> index 119d092..92ec346 100644
>> --- a/include/linux/skbuff.h
>> +++ b/include/linux/skbuff.h
>> @@ -3505,13 +3505,19 @@ static inline bool __skb_metadata_differs(const struct sk_buff *skb_a,
>> #define __it(x, op) (x -= sizeof(u##op))
>> #define __it_diff(a, b, op) (*(u##op *)__it(a, op)) ^ (*(u##op *)__it(b, op))
>> case 32: diffs |= __it_diff(a, b, 64);
>> + /* fall through */
>> case 24: diffs |= __it_diff(a, b, 64);
>> + /* fall through */
>> case 16: diffs |= __it_diff(a, b, 64);
>> + /* fall through */
>> case 8: diffs |= __it_diff(a, b, 64);
>> break;
>> case 28: diffs |= __it_diff(a, b, 64);
>> + /* fall through */
>> case 20: diffs |= __it_diff(a, b, 64);
>> + /* fall through */
>> case 12: diffs |= __it_diff(a, b, 64);
>> + /* fall through */
>> case 4: diffs |= __it_diff(a, b, 32);
>> break;
>> }
>> --
>> 2.7.4
>>
>
>
>
> --
> Kees Cook
> Pixel Security
--
Kees Cook
Pixel Security
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] skbuff: Mark expected switch fall-throughs
2018-10-16 22:41 ` Kees Cook
@ 2018-10-17 10:55 ` Gustavo A. R. Silva
0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2018-10-17 10:55 UTC (permalink / raw)
To: Kees Cook; +Cc: Andrew Morton, LKML
On 10/17/18 12:41 AM, Kees Cook wrote:
>
> Actually, since this is skbuff, can you resend this to netdev instead?
> Andrew took the other two, but this one seems like it should go via
> David Miller.
>
Sure thing. Will do.
Thanks
--
Gustavo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-10-17 10:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-13 11:56 [PATCH] skbuff: Mark expected switch fall-throughs Gustavo A. R. Silva
2018-10-15 21:30 ` Kees Cook
2018-10-16 22:41 ` Kees Cook
2018-10-17 10:55 ` Gustavo A. R. Silva
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.