linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASN.1: mark expected switch fall-throughs
@ 2019-01-25 20:48 Gustavo A. R. Silva
  2019-01-26  0:38 ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Gustavo A. R. Silva @ 2019-01-25 20:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Gustavo A. R. Silva, Kees Cook

In preparation to enabling -Wimplicit-fallthrough, mark switch
cases where we are expecting to fall through.

This patch fixes the following warnings:

lib/asn1_decoder.c:386:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
lib/asn1_decoder.c:449:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enabling
-Wimplicit-fallthrough.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 lib/asn1_decoder.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c
index dc14beae2c9a..8f3d207d2b00 100644
--- a/lib/asn1_decoder.c
+++ b/lib/asn1_decoder.c
@@ -385,6 +385,8 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
 	case ASN1_OP_END_SET_ACT:
 		if (unlikely(!(flags & FLAG_MATCHED)))
 			goto tag_mismatch;
+		/* fall through */
+
 	case ASN1_OP_END_SEQ:
 	case ASN1_OP_END_SET_OF:
 	case ASN1_OP_END_SEQ_OF:
@@ -450,6 +452,8 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
 			pc += asn1_op_lengths[op];
 			goto next_op;
 		}
+		/* fall through */
+
 	case ASN1_OP_ACT:
 		ret = actions[machine[pc + 1]](context, hdr, tag, data + tdp, len);
 		if (ret < 0)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASN.1: mark expected switch fall-throughs
  2019-01-25 20:48 [PATCH] ASN.1: mark expected switch fall-throughs Gustavo A. R. Silva
@ 2019-01-26  0:38 ` Kees Cook
  2019-01-26  0:57   ` Gustavo A. R. Silva
  0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2019-01-26  0:38 UTC (permalink / raw)
  To: Gustavo A. R. Silva; +Cc: LKML

On Sat, Jan 26, 2019 at 9:49 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.
>
> This patch fixes the following warnings:
>
> lib/asn1_decoder.c:386:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> lib/asn1_decoder.c:449:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>
> Warning level 3 was used: -Wimplicit-fallthrough=3
>
> This patch is part of the ongoing efforts to enabling
> -Wimplicit-fallthrough.
>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  lib/asn1_decoder.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c
> index dc14beae2c9a..8f3d207d2b00 100644
> --- a/lib/asn1_decoder.c
> +++ b/lib/asn1_decoder.c
> @@ -385,6 +385,8 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
>         case ASN1_OP_END_SET_ACT:
>                 if (unlikely(!(flags & FLAG_MATCHED)))
>                         goto tag_mismatch;
> +               /* fall through */
> +
>         case ASN1_OP_END_SEQ:
>         case ASN1_OP_END_SET_OF:
>         case ASN1_OP_END_SEQ_OF:
> @@ -450,6 +452,8 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
>                         pc += asn1_op_lengths[op];
>                         goto next_op;
>                 }
> +               /* fall through */
> +
>         case ASN1_OP_ACT:
>                 ret = actions[machine[pc + 1]](context, hdr, tag, data + tdp, len);
>                 if (ret < 0)
> --
> 2.20.1
>


-- 
Kees Cook

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASN.1: mark expected switch fall-throughs
  2019-01-26  0:38 ` Kees Cook
@ 2019-01-26  0:57   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2019-01-26  0:57 UTC (permalink / raw)
  To: Kees Cook; +Cc: LKML



On 1/25/19 6:38 PM, Kees Cook wrote:
> On Sat, Jan 26, 2019 at 9:49 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.
>>
>> This patch fixes the following warnings:
>>
>> lib/asn1_decoder.c:386:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>> lib/asn1_decoder.c:449:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>
>> Warning level 3 was used: -Wimplicit-fallthrough=3
>>
>> This patch is part of the ongoing efforts to enabling
>> -Wimplicit-fallthrough.
>>
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> 
> Reviewed-by: Kees Cook <keescook@chromium.org>
> 

Now applied to for-next/kspp, thanks.

https://git.kernel.org/gustavoars/c/482c7212e6af6a3362e337fb49e2e101e4578644

Cheers!
--
Gustavo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-26  0:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-25 20:48 [PATCH] ASN.1: mark expected switch fall-throughs Gustavo A. R. Silva
2019-01-26  0:38 ` Kees Cook
2019-01-26  0:57   ` Gustavo A. R. Silva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).